{"action":"created","comment":{"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/comments/29841482","id":29841482,"diff_hunk":"@@ -48,12 +57,21 @@ def field_order\n \n   private\n \n+  def check_for_changes\n+    @old_firm_id = firm_id_change.first if firm_id_changed?\n+  end\n+\n   def geocode\n     if destroyed?\n       firm.geocode\n     elsif valid?\n       GeocodeAdviserJob.perform_later(self)\n     end\n+\n+    if @old_firm_id.present?\n+      IndexFirmJob.perform_later(@old_firm_id)\n+      @old_firm_id = nil\n+    end","path":"app/models/adviser.rb","position":34,"original_position":34,"commit_id":"eda6aab35acd9c4693477124b03ecb717db7535f","original_commit_id":"eda6aab35acd9c4693477124b03ecb717db7535f","user":{"login":"neoeno","id":1007202,"avatar_url":"https://avatars.githubusercontent.com/u/1007202?v=3","gravatar_id":"","url":"https://api.github.com/users/neoeno","html_url":"https://github.com/neoeno","followers_url":"https://api.github.com/users/neoeno/followers","following_url":"https://api.github.com/users/neoeno/following{/other_user}","gists_url":"https://api.github.com/users/neoeno/gists{/gist_id}","starred_url":"https://api.github.com/users/neoeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoeno/subscriptions","organizations_url":"https://api.github.com/users/neoeno/orgs","repos_url":"https://api.github.com/users/neoeno/repos","events_url":"https://api.github.com/users/neoeno/events{/privacy}","received_events_url":"https://api.github.com/users/neoeno/received_events","type":"User","site_admin":false},"body":"Further, could we put this in a different method with a different callback? Since it's not directly related to geocoding. Or possibly rename this callback to call through to geocode and a method containing this new code.","created_at":"2015-05-07T10:47:55Z","updated_at":"2015-05-07T10:47:55Z","html_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/58#discussion_r29841482","pull_request_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/comments/29841482"},"html":{"href":"https://github.com/moneyadviceservice/mas-rad_core/pull/58#discussion_r29841482"},"pull_request":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58","id":34902829,"html_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/58","diff_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/58.diff","patch_url":"https://github.com/moneyadviceservice/mas-rad_core/pull/58.patch","issue_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/58","number":58,"state":"open","locked":false,"title":"Move advisers","user":{"login":"munckymagik","id":306583,"avatar_url":"https://avatars.githubusercontent.com/u/306583?v=3","gravatar_id":"","url":"https://api.github.com/users/munckymagik","html_url":"https://github.com/munckymagik","followers_url":"https://api.github.com/users/munckymagik/followers","following_url":"https://api.github.com/users/munckymagik/following{/other_user}","gists_url":"https://api.github.com/users/munckymagik/gists{/gist_id}","starred_url":"https://api.github.com/users/munckymagik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munckymagik/subscriptions","organizations_url":"https://api.github.com/users/munckymagik/orgs","repos_url":"https://api.github.com/users/munckymagik/repos","events_url":"https://api.github.com/users/munckymagik/events{/privacy}","received_events_url":"https://api.github.com/users/munckymagik/received_events","type":"User","site_admin":false},"body":"Implement moving single or batches of advisers between firms.\r\n\r\nEnsures all records get re-indexed in ES.\r\n\r\nExample client code:\r\n\r\n```ruby\r\n# Find the advisers you want to move, in this case restricting just to advisers in the one firm\r\nfrom_firm = Firm.find_by(fca_number: ....)\r\nref_nums = ['GBP00003', 'RMP01116']\r\nadvisers_to_move = from_firm.advisers.where(reference_number: ref_nums)\r\n\r\n# Validation for this scenario, e.g.\r\nfail 'not all advisers are in the same firm' if ref_nums.size != advisers_to_move.count\r\n\r\n# Move the advisers. `move_to` operates only on the `advisers_to_move` result set\r\nreceiving_firm = Firm.find_by(fca_number: ....)\r\nadvisers_to_move.move_to(receiving_firm)\r\n```\r\n","created_at":"2015-05-07T10:38:15Z","updated_at":"2015-05-07T10:47:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4f3258c897cd9bf291f41a915708bbf98a91d03","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58/commits","review_comments_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58/comments","review_comment_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/58/comments","statuses_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/statuses/eda6aab35acd9c4693477124b03ecb717db7535f","head":{"label":"moneyadviceservice:move_advisers","ref":"move_advisers","sha":"eda6aab35acd9c4693477124b03ecb717db7535f","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":30658923,"name":"mas-rad_core","full_name":"moneyadviceservice/mas-rad_core","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/mas-rad_core","description":"Models and core logic engine for the RAD family of products and services","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core","forks_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/releases{/id}","created_at":"2015-02-11T17:01:07Z","updated_at":"2015-05-07T09:29:40Z","pushed_at":"2015-05-07T10:38:16Z","git_url":"git://github.com/moneyadviceservice/mas-rad_core.git","ssh_url":"git@github.com:moneyadviceservice/mas-rad_core.git","clone_url":"https://github.com/moneyadviceservice/mas-rad_core.git","svn_url":"https://github.com/moneyadviceservice/mas-rad_core","homepage":null,"size":1504,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"moneyadviceservice:master","ref":"master","sha":"e1d9cb4f8f8bc97be35ce6eefbc4ac80cc594796","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":30658923,"name":"mas-rad_core","full_name":"moneyadviceservice/mas-rad_core","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/mas-rad_core","description":"Models and core logic engine for the RAD family of products and services","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core","forks_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/releases{/id}","created_at":"2015-02-11T17:01:07Z","updated_at":"2015-05-07T09:29:40Z","pushed_at":"2015-05-07T10:38:16Z","git_url":"git://github.com/moneyadviceservice/mas-rad_core.git","ssh_url":"git@github.com:moneyadviceservice/mas-rad_core.git","clone_url":"https://github.com/moneyadviceservice/mas-rad_core.git","svn_url":"https://github.com/moneyadviceservice/mas-rad_core","homepage":null,"size":1504,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58"},"html":{"href":"https://github.com/moneyadviceservice/mas-rad_core/pull/58"},"issue":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/58"},"comments":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/moneyadviceservice/mas-rad_core/statuses/eda6aab35acd9c4693477124b03ecb717db7535f"}}}}