{"action":"created","comment":{"url":"https://api.github.com/repos/cmacaulay/bike-share/pulls/comments/98380995","pull_request_review_id":19019050,"id":98380995,"diff_hunk":"@@ -1,3 +1,71 @@\n class Station < ActiveRecord::Base\n-  validates :name, :dock_count, :city, :installation_date, presence: true\n+  belongs_to :city\n+  validates :name,\n+            :dock_count,\n+            :city_id,\n+            :installation_date,\n+            presence: true\n+\n+  def self.record(station_information)\n+    self.find_or_create_by(name:       station_information[:name],\n+                           dock_count: station_information[:dock_count],\n+                           city_id: find_city_id(station_information[:city_name]),\n+                           installation_date: station_information[:installation_date]\n+                          )\n+  end\n+\n+  def self.record_update(station, station_information)","path":"app/models/station.rb","position":18,"original_position":18,"commit_id":"a80d3da360feab17e92ff87478e4d92a3cb63ad8","original_commit_id":"a80d3da360feab17e92ff87478e4d92a3cb63ad8","user":{"login":"cmacaulay","id":9217701,"avatar_url":"https://avatars.githubusercontent.com/u/9217701?v=3","gravatar_id":"","url":"https://api.github.com/users/cmacaulay","html_url":"https://github.com/cmacaulay","followers_url":"https://api.github.com/users/cmacaulay/followers","following_url":"https://api.github.com/users/cmacaulay/following{/other_user}","gists_url":"https://api.github.com/users/cmacaulay/gists{/gist_id}","starred_url":"https://api.github.com/users/cmacaulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmacaulay/subscriptions","organizations_url":"https://api.github.com/users/cmacaulay/orgs","repos_url":"https://api.github.com/users/cmacaulay/repos","events_url":"https://api.github.com/users/cmacaulay/events{/privacy}","received_events_url":"https://api.github.com/users/cmacaulay/received_events","type":"User","site_admin":false},"body":"this is the new update method being called on in the route. the reason we can't use the built in \"update\" method is that our station model requires a city_id in order to validate. we can't expect our user to know what the city id is, so we need something that translates the name that they enter into the city_id in order for the station to be valid. ","created_at":"2017-01-30T05:17:42Z","updated_at":"2017-01-30T05:17:42Z","html_url":"https://github.com/cmacaulay/bike-share/pull/70#discussion_r98380995","pull_request_url":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/cmacaulay/bike-share/pulls/comments/98380995"},"html":{"href":"https://github.com/cmacaulay/bike-share/pull/70#discussion_r98380995"},"pull_request":{"href":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70","id":103679996,"html_url":"https://github.com/cmacaulay/bike-share/pull/70","diff_url":"https://github.com/cmacaulay/bike-share/pull/70.diff","patch_url":"https://github.com/cmacaulay/bike-share/pull/70.patch","issue_url":"https://api.github.com/repos/cmacaulay/bike-share/issues/70","number":70,"state":"open","locked":false,"title":"fixes city_id/city relationship","user":{"login":"cmacaulay","id":9217701,"avatar_url":"https://avatars.githubusercontent.com/u/9217701?v=3","gravatar_id":"","url":"https://api.github.com/users/cmacaulay","html_url":"https://github.com/cmacaulay","followers_url":"https://api.github.com/users/cmacaulay/followers","following_url":"https://api.github.com/users/cmacaulay/following{/other_user}","gists_url":"https://api.github.com/users/cmacaulay/gists{/gist_id}","starred_url":"https://api.github.com/users/cmacaulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmacaulay/subscriptions","organizations_url":"https://api.github.com/users/cmacaulay/orgs","repos_url":"https://api.github.com/users/cmacaulay/repos","events_url":"https://api.github.com/users/cmacaulay/events{/privacy}","received_events_url":"https://api.github.com/users/cmacaulay/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-01-30T05:09:53Z","updated_at":"2017-01-30T05:17:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"69072e73ebcdc95d65ba22147d88ef3bf75c656b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70/commits","review_comments_url":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70/comments","review_comment_url":"https://api.github.com/repos/cmacaulay/bike-share/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cmacaulay/bike-share/issues/70/comments","statuses_url":"https://api.github.com/repos/cmacaulay/bike-share/statuses/a80d3da360feab17e92ff87478e4d92a3cb63ad8","head":{"label":"cmacaulay:casey_iteration_4","ref":"casey_iteration_4","sha":"a80d3da360feab17e92ff87478e4d92a3cb63ad8","user":{"login":"cmacaulay","id":9217701,"avatar_url":"https://avatars.githubusercontent.com/u/9217701?v=3","gravatar_id":"","url":"https://api.github.com/users/cmacaulay","html_url":"https://github.com/cmacaulay","followers_url":"https://api.github.com/users/cmacaulay/followers","following_url":"https://api.github.com/users/cmacaulay/following{/other_user}","gists_url":"https://api.github.com/users/cmacaulay/gists{/gist_id}","starred_url":"https://api.github.com/users/cmacaulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmacaulay/subscriptions","organizations_url":"https://api.github.com/users/cmacaulay/orgs","repos_url":"https://api.github.com/users/cmacaulay/repos","events_url":"https://api.github.com/users/cmacaulay/events{/privacy}","received_events_url":"https://api.github.com/users/cmacaulay/received_events","type":"User","site_admin":false},"repo":{"id":80161846,"name":"bike-share","full_name":"cmacaulay/bike-share","owner":{"login":"cmacaulay","id":9217701,"avatar_url":"https://avatars.githubusercontent.com/u/9217701?v=3","gravatar_id":"","url":"https://api.github.com/users/cmacaulay","html_url":"https://github.com/cmacaulay","followers_url":"https://api.github.com/users/cmacaulay/followers","following_url":"https://api.github.com/users/cmacaulay/following{/other_user}","gists_url":"https://api.github.com/users/cmacaulay/gists{/gist_id}","starred_url":"https://api.github.com/users/cmacaulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmacaulay/subscriptions","organizations_url":"https://api.github.com/users/cmacaulay/orgs","repos_url":"https://api.github.com/users/cmacaulay/repos","events_url":"https://api.github.com/users/cmacaulay/events{/privacy}","received_events_url":"https://api.github.com/users/cmacaulay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cmacaulay/bike-share","description":null,"fork":false,"url":"https://api.github.com/repos/cmacaulay/bike-share","forks_url":"https://api.github.com/repos/cmacaulay/bike-share/forks","keys_url":"https://api.github.com/repos/cmacaulay/bike-share/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmacaulay/bike-share/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmacaulay/bike-share/teams","hooks_url":"https://api.github.com/repos/cmacaulay/bike-share/hooks","issue_events_url":"https://api.github.com/repos/cmacaulay/bike-share/issues/events{/number}","events_url":"https://api.github.com/repos/cmacaulay/bike-share/events","assignees_url":"https://api.github.com/repos/cmacaulay/bike-share/assignees{/user}","branches_url":"https://api.github.com/repos/cmacaulay/bike-share/branches{/branch}","tags_url":"https://api.github.com/repos/cmacaulay/bike-share/tags","blobs_url":"https://api.github.com/repos/cmacaulay/bike-share/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmacaulay/bike-share/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmacaulay/bike-share/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmacaulay/bike-share/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmacaulay/bike-share/statuses/{sha}","languages_url":"https://api.github.com/repos/cmacaulay/bike-share/languages","stargazers_url":"https://api.github.com/repos/cmacaulay/bike-share/stargazers","contributors_url":"https://api.github.com/repos/cmacaulay/bike-share/contributors","subscribers_url":"https://api.github.com/repos/cmacaulay/bike-share/subscribers","subscription_url":"https://api.github.com/repos/cmacaulay/bike-share/subscription","commits_url":"https://api.github.com/repos/cmacaulay/bike-share/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmacaulay/bike-share/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmacaulay/bike-share/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmacaulay/bike-share/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmacaulay/bike-share/contents/{+path}","compare_url":"https://api.github.com/repos/cmacaulay/bike-share/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmacaulay/bike-share/merges","archive_url":"https://api.github.com/repos/cmacaulay/bike-share/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmacaulay/bike-share/downloads","issues_url":"https://api.github.com/repos/cmacaulay/bike-share/issues{/number}","pulls_url":"https://api.github.com/repos/cmacaulay/bike-share/pulls{/number}","milestones_url":"https://api.github.com/repos/cmacaulay/bike-share/milestones{/number}","notifications_url":"https://api.github.com/repos/cmacaulay/bike-share/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmacaulay/bike-share/labels{/name}","releases_url":"https://api.github.com/repos/cmacaulay/bike-share/releases{/id}","deployments_url":"https://api.github.com/repos/cmacaulay/bike-share/deployments","created_at":"2017-01-26T22:27:49Z","updated_at":"2017-01-26T22:32:05Z","pushed_at":"2017-01-30T05:09:53Z","git_url":"git://github.com/cmacaulay/bike-share.git","ssh_url":"git@github.com:cmacaulay/bike-share.git","clone_url":"https://github.com/cmacaulay/bike-share.git","svn_url":"https://github.com/cmacaulay/bike-share","homepage":null,"size":1687,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":21,"forks":1,"open_issues":21,"watchers":0,"default_branch":"master"}},"base":{"label":"cmacaulay:master","ref":"master","sha":"9a7f7eb6d92b337b0ef885f5741511dd97488475","user":{"login":"cmacaulay","id":9217701,"avatar_url":"https://avatars.githubusercontent.com/u/9217701?v=3","gravatar_id":"","url":"https://api.github.com/users/cmacaulay","html_url":"https://github.com/cmacaulay","followers_url":"https://api.github.com/users/cmacaulay/followers","following_url":"https://api.github.com/users/cmacaulay/following{/other_user}","gists_url":"https://api.github.com/users/cmacaulay/gists{/gist_id}","starred_url":"https://api.github.com/users/cmacaulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmacaulay/subscriptions","organizations_url":"https://api.github.com/users/cmacaulay/orgs","repos_url":"https://api.github.com/users/cmacaulay/repos","events_url":"https://api.github.com/users/cmacaulay/events{/privacy}","received_events_url":"https://api.github.com/users/cmacaulay/received_events","type":"User","site_admin":false},"repo":{"id":80161846,"name":"bike-share","full_name":"cmacaulay/bike-share","owner":{"login":"cmacaulay","id":9217701,"avatar_url":"https://avatars.githubusercontent.com/u/9217701?v=3","gravatar_id":"","url":"https://api.github.com/users/cmacaulay","html_url":"https://github.com/cmacaulay","followers_url":"https://api.github.com/users/cmacaulay/followers","following_url":"https://api.github.com/users/cmacaulay/following{/other_user}","gists_url":"https://api.github.com/users/cmacaulay/gists{/gist_id}","starred_url":"https://api.github.com/users/cmacaulay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmacaulay/subscriptions","organizations_url":"https://api.github.com/users/cmacaulay/orgs","repos_url":"https://api.github.com/users/cmacaulay/repos","events_url":"https://api.github.com/users/cmacaulay/events{/privacy}","received_events_url":"https://api.github.com/users/cmacaulay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cmacaulay/bike-share","description":null,"fork":false,"url":"https://api.github.com/repos/cmacaulay/bike-share","forks_url":"https://api.github.com/repos/cmacaulay/bike-share/forks","keys_url":"https://api.github.com/repos/cmacaulay/bike-share/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmacaulay/bike-share/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmacaulay/bike-share/teams","hooks_url":"https://api.github.com/repos/cmacaulay/bike-share/hooks","issue_events_url":"https://api.github.com/repos/cmacaulay/bike-share/issues/events{/number}","events_url":"https://api.github.com/repos/cmacaulay/bike-share/events","assignees_url":"https://api.github.com/repos/cmacaulay/bike-share/assignees{/user}","branches_url":"https://api.github.com/repos/cmacaulay/bike-share/branches{/branch}","tags_url":"https://api.github.com/repos/cmacaulay/bike-share/tags","blobs_url":"https://api.github.com/repos/cmacaulay/bike-share/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmacaulay/bike-share/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmacaulay/bike-share/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmacaulay/bike-share/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmacaulay/bike-share/statuses/{sha}","languages_url":"https://api.github.com/repos/cmacaulay/bike-share/languages","stargazers_url":"https://api.github.com/repos/cmacaulay/bike-share/stargazers","contributors_url":"https://api.github.com/repos/cmacaulay/bike-share/contributors","subscribers_url":"https://api.github.com/repos/cmacaulay/bike-share/subscribers","subscription_url":"https://api.github.com/repos/cmacaulay/bike-share/subscription","commits_url":"https://api.github.com/repos/cmacaulay/bike-share/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmacaulay/bike-share/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmacaulay/bike-share/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmacaulay/bike-share/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmacaulay/bike-share/contents/{+path}","compare_url":"https://api.github.com/repos/cmacaulay/bike-share/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmacaulay/bike-share/merges","archive_url":"https://api.github.com/repos/cmacaulay/bike-share/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmacaulay/bike-share/downloads","issues_url":"https://api.github.com/repos/cmacaulay/bike-share/issues{/number}","pulls_url":"https://api.github.com/repos/cmacaulay/bike-share/pulls{/number}","milestones_url":"https://api.github.com/repos/cmacaulay/bike-share/milestones{/number}","notifications_url":"https://api.github.com/repos/cmacaulay/bike-share/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmacaulay/bike-share/labels{/name}","releases_url":"https://api.github.com/repos/cmacaulay/bike-share/releases{/id}","deployments_url":"https://api.github.com/repos/cmacaulay/bike-share/deployments","created_at":"2017-01-26T22:27:49Z","updated_at":"2017-01-26T22:32:05Z","pushed_at":"2017-01-30T05:09:53Z","git_url":"git://github.com/cmacaulay/bike-share.git","ssh_url":"git@github.com:cmacaulay/bike-share.git","clone_url":"https://github.com/cmacaulay/bike-share.git","svn_url":"https://github.com/cmacaulay/bike-share","homepage":null,"size":1687,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":21,"forks":1,"open_issues":21,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70"},"html":{"href":"https://github.com/cmacaulay/bike-share/pull/70"},"issue":{"href":"https://api.github.com/repos/cmacaulay/bike-share/issues/70"},"comments":{"href":"https://api.github.com/repos/cmacaulay/bike-share/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/cmacaulay/bike-share/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cmacaulay/bike-share/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/cmacaulay/bike-share/statuses/a80d3da360feab17e92ff87478e4d92a3cb63ad8"}}}}
{"actor":{"display_login":"cmacaulay"}}