{"action":"created","comment":{"url":"https://api.github.com/repos/geokit/geokit-rails/pulls/comments/26173545","id":26173545,"diff_hunk":"@@ -326,11 +328,20 @@ def sphere_distance_sql(origin, units)\n       # to the database in use.\n       def flat_distance_sql(origin, units)\n         lat_degree_units = units_per_latitude_degree(units)\n-        lng_degree_units = units_per_longitude_degree(origin.lat, units)\n-\n+        lng_degree_units = units_per_longitude_degree(get_lat(origin), units)\n         adapter.flat_distance_sql(origin, lat_degree_units, lng_degree_units)\n       end\n \n+      def get_lat(origin)\n+        origin.respond_to?(:lat) ? origin.lat \\\n+                                 : origin.send(:\"#{lat_column_name}\")\n+      end\n+\n+      def get_lng(origin)\n+        origin.respond_to?(:lng) ? origin.lng \\","path":"lib/geokit-rails/acts_as_mappable.rb","position":32,"original_position":32,"commit_id":"6934bff972a076a0228fd0d326c47ad0366e1964","original_commit_id":"6934bff972a076a0228fd0d326c47ad0366e1964","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Avoid multi-line ?: (the ternary operator); use `if`/`unless` instead.","created_at":"2015-03-10T22:33:28Z","updated_at":"2015-03-10T22:33:28Z","html_url":"https://github.com/geokit/geokit-rails/pull/72#discussion_r26173545","pull_request_url":"https://api.github.com/repos/geokit/geokit-rails/pulls/72","_links":{"self":{"href":"https://api.github.com/repos/geokit/geokit-rails/pulls/comments/26173545"},"html":{"href":"https://github.com/geokit/geokit-rails/pull/72#discussion_r26173545"},"pull_request":{"href":"https://api.github.com/repos/geokit/geokit-rails/pulls/72"}}},"pull_request":{"url":"https://api.github.com/repos/geokit/geokit-rails/pulls/72","id":30805897,"html_url":"https://github.com/geokit/geokit-rails/pull/72","diff_url":"https://github.com/geokit/geokit-rails/pull/72.diff","patch_url":"https://github.com/geokit/geokit-rails/pull/72.patch","issue_url":"https://api.github.com/repos/geokit/geokit-rails/issues/72","number":72,"state":"open","locked":false,"title":"Update *_distance_sql to work with customized latitude and longitude attribute names","user":{"login":"jensb","id":44540,"avatar_url":"https://avatars.githubusercontent.com/u/44540?v=3","gravatar_id":"","url":"https://api.github.com/users/jensb","html_url":"https://github.com/jensb","followers_url":"https://api.github.com/users/jensb/followers","following_url":"https://api.github.com/users/jensb/following{/other_user}","gists_url":"https://api.github.com/users/jensb/gists{/gist_id}","starred_url":"https://api.github.com/users/jensb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jensb/subscriptions","organizations_url":"https://api.github.com/users/jensb/orgs","repos_url":"https://api.github.com/users/jensb/repos","events_url":"https://api.github.com/users/jensb/events{/privacy}","received_events_url":"https://api.github.com/users/jensb/received_events","type":"User","site_admin":false},"body":"... as well as lat/lng attributes.\r\n\r\nThis has bugged me since Rails 3.0, please give it a look. Without this patch, it is not possible to use the distance_sql methods if you use custom lat/lng attribute names.\r\n\r\nThank you!","created_at":"2015-03-09T22:20:21Z","updated_at":"2015-03-10T22:33:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1a44d04a61dc6d21acb00b1f5f38ba133a2c4a4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/geokit/geokit-rails/pulls/72/commits","review_comments_url":"https://api.github.com/repos/geokit/geokit-rails/pulls/72/comments","review_comment_url":"https://api.github.com/repos/geokit/geokit-rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geokit/geokit-rails/issues/72/comments","statuses_url":"https://api.github.com/repos/geokit/geokit-rails/statuses/6934bff972a076a0228fd0d326c47ad0366e1964","head":{"label":"jensb:master","ref":"master","sha":"6934bff972a076a0228fd0d326c47ad0366e1964","user":{"login":"jensb","id":44540,"avatar_url":"https://avatars.githubusercontent.com/u/44540?v=3","gravatar_id":"","url":"https://api.github.com/users/jensb","html_url":"https://github.com/jensb","followers_url":"https://api.github.com/users/jensb/followers","following_url":"https://api.github.com/users/jensb/following{/other_user}","gists_url":"https://api.github.com/users/jensb/gists{/gist_id}","starred_url":"https://api.github.com/users/jensb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jensb/subscriptions","organizations_url":"https://api.github.com/users/jensb/orgs","repos_url":"https://api.github.com/users/jensb/repos","events_url":"https://api.github.com/users/jensb/events{/privacy}","received_events_url":"https://api.github.com/users/jensb/received_events","type":"User","site_admin":false},"repo":{"id":30488500,"name":"geokit-rails","full_name":"jensb/geokit-rails","owner":{"login":"jensb","id":44540,"avatar_url":"https://avatars.githubusercontent.com/u/44540?v=3","gravatar_id":"","url":"https://api.github.com/users/jensb","html_url":"https://github.com/jensb","followers_url":"https://api.github.com/users/jensb/followers","following_url":"https://api.github.com/users/jensb/following{/other_user}","gists_url":"https://api.github.com/users/jensb/gists{/gist_id}","starred_url":"https://api.github.com/users/jensb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jensb/subscriptions","organizations_url":"https://api.github.com/users/jensb/orgs","repos_url":"https://api.github.com/users/jensb/repos","events_url":"https://api.github.com/users/jensb/events{/privacy}","received_events_url":"https://api.github.com/users/jensb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jensb/geokit-rails","description":"Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.","fork":true,"url":"https://api.github.com/repos/jensb/geokit-rails","forks_url":"https://api.github.com/repos/jensb/geokit-rails/forks","keys_url":"https://api.github.com/repos/jensb/geokit-rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jensb/geokit-rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jensb/geokit-rails/teams","hooks_url":"https://api.github.com/repos/jensb/geokit-rails/hooks","issue_events_url":"https://api.github.com/repos/jensb/geokit-rails/issues/events{/number}","events_url":"https://api.github.com/repos/jensb/geokit-rails/events","assignees_url":"https://api.github.com/repos/jensb/geokit-rails/assignees{/user}","branches_url":"https://api.github.com/repos/jensb/geokit-rails/branches{/branch}","tags_url":"https://api.github.com/repos/jensb/geokit-rails/tags","blobs_url":"https://api.github.com/repos/jensb/geokit-rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jensb/geokit-rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jensb/geokit-rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/jensb/geokit-rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jensb/geokit-rails/statuses/{sha}","languages_url":"https://api.github.com/repos/jensb/geokit-rails/languages","stargazers_url":"https://api.github.com/repos/jensb/geokit-rails/stargazers","contributors_url":"https://api.github.com/repos/jensb/geokit-rails/contributors","subscribers_url":"https://api.github.com/repos/jensb/geokit-rails/subscribers","subscription_url":"https://api.github.com/repos/jensb/geokit-rails/subscription","commits_url":"https://api.github.com/repos/jensb/geokit-rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/jensb/geokit-rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/jensb/geokit-rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/jensb/geokit-rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/jensb/geokit-rails/contents/{+path}","compare_url":"https://api.github.com/repos/jensb/geokit-rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jensb/geokit-rails/merges","archive_url":"https://api.github.com/repos/jensb/geokit-rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jensb/geokit-rails/downloads","issues_url":"https://api.github.com/repos/jensb/geokit-rails/issues{/number}","pulls_url":"https://api.github.com/repos/jensb/geokit-rails/pulls{/number}","milestones_url":"https://api.github.com/repos/jensb/geokit-rails/milestones{/number}","notifications_url":"https://api.github.com/repos/jensb/geokit-rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jensb/geokit-rails/labels{/name}","releases_url":"https://api.github.com/repos/jensb/geokit-rails/releases{/id}","created_at":"2015-02-08T11:03:31Z","updated_at":"2015-03-10T22:33:15Z","pushed_at":"2015-03-10T22:33:15Z","git_url":"git://github.com/jensb/geokit-rails.git","ssh_url":"git@github.com:jensb/geokit-rails.git","clone_url":"https://github.com/jensb/geokit-rails.git","svn_url":"https://github.com/jensb/geokit-rails","homepage":"","size":341,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"geokit:master","ref":"master","sha":"a2a36d2a5ab0e8387136353b6232db448026876f","user":{"login":"geokit","id":1250694,"avatar_url":"https://avatars.githubusercontent.com/u/1250694?v=3","gravatar_id":"","url":"https://api.github.com/users/geokit","html_url":"https://github.com/geokit","followers_url":"https://api.github.com/users/geokit/followers","following_url":"https://api.github.com/users/geokit/following{/other_user}","gists_url":"https://api.github.com/users/geokit/gists{/gist_id}","starred_url":"https://api.github.com/users/geokit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geokit/subscriptions","organizations_url":"https://api.github.com/users/geokit/orgs","repos_url":"https://api.github.com/users/geokit/repos","events_url":"https://api.github.com/users/geokit/events{/privacy}","received_events_url":"https://api.github.com/users/geokit/received_events","type":"Organization","site_admin":false},"repo":{"id":93340,"name":"geokit-rails","full_name":"geokit/geokit-rails","owner":{"login":"geokit","id":1250694,"avatar_url":"https://avatars.githubusercontent.com/u/1250694?v=3","gravatar_id":"","url":"https://api.github.com/users/geokit","html_url":"https://github.com/geokit","followers_url":"https://api.github.com/users/geokit/followers","following_url":"https://api.github.com/users/geokit/following{/other_user}","gists_url":"https://api.github.com/users/geokit/gists{/gist_id}","starred_url":"https://api.github.com/users/geokit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geokit/subscriptions","organizations_url":"https://api.github.com/users/geokit/orgs","repos_url":"https://api.github.com/users/geokit/repos","events_url":"https://api.github.com/users/geokit/events{/privacy}","received_events_url":"https://api.github.com/users/geokit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geokit/geokit-rails","description":"Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.","fork":false,"url":"https://api.github.com/repos/geokit/geokit-rails","forks_url":"https://api.github.com/repos/geokit/geokit-rails/forks","keys_url":"https://api.github.com/repos/geokit/geokit-rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geokit/geokit-rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geokit/geokit-rails/teams","hooks_url":"https://api.github.com/repos/geokit/geokit-rails/hooks","issue_events_url":"https://api.github.com/repos/geokit/geokit-rails/issues/events{/number}","events_url":"https://api.github.com/repos/geokit/geokit-rails/events","assignees_url":"https://api.github.com/repos/geokit/geokit-rails/assignees{/user}","branches_url":"https://api.github.com/repos/geokit/geokit-rails/branches{/branch}","tags_url":"https://api.github.com/repos/geokit/geokit-rails/tags","blobs_url":"https://api.github.com/repos/geokit/geokit-rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geokit/geokit-rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geokit/geokit-rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/geokit/geokit-rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geokit/geokit-rails/statuses/{sha}","languages_url":"https://api.github.com/repos/geokit/geokit-rails/languages","stargazers_url":"https://api.github.com/repos/geokit/geokit-rails/stargazers","contributors_url":"https://api.github.com/repos/geokit/geokit-rails/contributors","subscribers_url":"https://api.github.com/repos/geokit/geokit-rails/subscribers","subscription_url":"https://api.github.com/repos/geokit/geokit-rails/subscription","commits_url":"https://api.github.com/repos/geokit/geokit-rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/geokit/geokit-rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/geokit/geokit-rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/geokit/geokit-rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/geokit/geokit-rails/contents/{+path}","compare_url":"https://api.github.com/repos/geokit/geokit-rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geokit/geokit-rails/merges","archive_url":"https://api.github.com/repos/geokit/geokit-rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geokit/geokit-rails/downloads","issues_url":"https://api.github.com/repos/geokit/geokit-rails/issues{/number}","pulls_url":"https://api.github.com/repos/geokit/geokit-rails/pulls{/number}","milestones_url":"https://api.github.com/repos/geokit/geokit-rails/milestones{/number}","notifications_url":"https://api.github.com/repos/geokit/geokit-rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geokit/geokit-rails/labels{/name}","releases_url":"https://api.github.com/repos/geokit/geokit-rails/releases{/id}","created_at":"2008-12-19T01:56:49Z","updated_at":"2015-03-09T05:13:07Z","pushed_at":"2014-12-09T07:28:09Z","git_url":"git://github.com/geokit/geokit-rails.git","ssh_url":"git@github.com:geokit/geokit-rails.git","clone_url":"https://github.com/geokit/geokit-rails.git","svn_url":"https://github.com/geokit/geokit-rails","homepage":"","size":643,"stargazers_count":833,"watchers_count":833,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":151,"mirror_url":null,"open_issues_count":38,"forks":151,"open_issues":38,"watchers":833,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geokit/geokit-rails/pulls/72"},"html":{"href":"https://github.com/geokit/geokit-rails/pull/72"},"issue":{"href":"https://api.github.com/repos/geokit/geokit-rails/issues/72"},"comments":{"href":"https://api.github.com/repos/geokit/geokit-rails/issues/72/comments"},"review_comments":{"href":"https://api.github.com/repos/geokit/geokit-rails/pulls/72/comments"},"review_comment":{"href":"https://api.github.com/repos/geokit/geokit-rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geokit/geokit-rails/pulls/72/commits"},"statuses":{"href":"https://api.github.com/repos/geokit/geokit-rails/statuses/6934bff972a076a0228fd0d326c47ad0366e1964"}}}}