{"action":"created","comment":{"url":"https://api.github.com/repos/entrision/lineup/pulls/comments/25806459","id":25806459,"diff_hunk":"@@ -4,17 +4,23 @@ class LineupPosition < ActiveRecord::Base\n \n   before_save :set_move_restrictions\n   before_save :set_match_count_at_change\n+\n   validates_presence_of :player\n   validates_uniqueness_of :player_id, scope: :player_lineup\n-  validates_with LineupMovementValidator, on: :update, if: :movement_validation_needed?\n+  validates_with BaseMovementValidator, on: :update, if: :basic_validation_needed?\n+  validates_with ExtendedMovementValidator, on: :update, if: :extended_validation_needed?\n \n   default_scope { order('position') }\n \n-  def movement_validation_needed?\n+  def basic_validation_needed?\n     # players have played at least 1 match, and the position has changed\n     (self.player.matches_played >= 1 && self.position_changed?) ? true : false","path":"app/models/lineup_position.rb","position":16,"original_position":16,"commit_id":"29a9009e699f452814bb1ebbea31f2c5499fdcea","original_commit_id":"29a9009e699f452814bb1ebbea31f2c5499fdcea","user":{"login":"timgremore","id":49427,"avatar_url":"https://avatars.githubusercontent.com/u/49427?v=3","gravatar_id":"","url":"https://api.github.com/users/timgremore","html_url":"https://github.com/timgremore","followers_url":"https://api.github.com/users/timgremore/followers","following_url":"https://api.github.com/users/timgremore/following{/other_user}","gists_url":"https://api.github.com/users/timgremore/gists{/gist_id}","starred_url":"https://api.github.com/users/timgremore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timgremore/subscriptions","organizations_url":"https://api.github.com/users/timgremore/orgs","repos_url":"https://api.github.com/users/timgremore/repos","events_url":"https://api.github.com/users/timgremore/events{/privacy}","received_events_url":"https://api.github.com/users/timgremore/received_events","type":"User","site_admin":false},"body":"Might be nitpicking but you could boil this down to:\r\n```\r\nplayer_matches_played >= 1 && position_changed?\r\n```\r\nAnd define ```player_matches_played``` using ```delegate :matches_played, to: :player, prefix: true``` earlier in your class definition.","created_at":"2015-03-04T19:41:36Z","updated_at":"2015-03-04T19:41:36Z","html_url":"https://github.com/entrision/lineup/pull/2#discussion_r25806459","pull_request_url":"https://api.github.com/repos/entrision/lineup/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/entrision/lineup/pulls/comments/25806459"},"html":{"href":"https://github.com/entrision/lineup/pull/2#discussion_r25806459"},"pull_request":{"href":"https://api.github.com/repos/entrision/lineup/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/entrision/lineup/pulls/2","id":30471755,"html_url":"https://github.com/entrision/lineup/pull/2","diff_url":"https://github.com/entrision/lineup/pull/2.diff","patch_url":"https://github.com/entrision/lineup/pull/2.patch","issue_url":"https://api.github.com/repos/entrision/lineup/issues/2","number":2,"state":"open","locked":false,"title":"Refactor validation","user":{"login":"jtperreault","id":498251,"avatar_url":"https://avatars.githubusercontent.com/u/498251?v=3","gravatar_id":"","url":"https://api.github.com/users/jtperreault","html_url":"https://github.com/jtperreault","followers_url":"https://api.github.com/users/jtperreault/followers","following_url":"https://api.github.com/users/jtperreault/following{/other_user}","gists_url":"https://api.github.com/users/jtperreault/gists{/gist_id}","starred_url":"https://api.github.com/users/jtperreault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtperreault/subscriptions","organizations_url":"https://api.github.com/users/jtperreault/orgs","repos_url":"https://api.github.com/users/jtperreault/repos","events_url":"https://api.github.com/users/jtperreault/events{/privacy}","received_events_url":"https://api.github.com/users/jtperreault/received_events","type":"User","site_admin":false},"body":"@timgremore let me know what you think when you get a spare moment. I separated the validation into 2 classes (base, extended) that get called accordingly. For the most part I like how it turned out. Also cleaned up the spec, which was really bugging me.","created_at":"2015-03-04T14:56:51Z","updated_at":"2015-03-04T19:41:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab8fbfff36cba93f5432eb2b2dd23fd0112d1ac2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/entrision/lineup/pulls/2/commits","review_comments_url":"https://api.github.com/repos/entrision/lineup/pulls/2/comments","review_comment_url":"https://api.github.com/repos/entrision/lineup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/entrision/lineup/issues/2/comments","statuses_url":"https://api.github.com/repos/entrision/lineup/statuses/29a9009e699f452814bb1ebbea31f2c5499fdcea","head":{"label":"entrision:refactor_validation","ref":"refactor_validation","sha":"29a9009e699f452814bb1ebbea31f2c5499fdcea","user":{"login":"entrision","id":4155190,"avatar_url":"https://avatars.githubusercontent.com/u/4155190?v=3","gravatar_id":"","url":"https://api.github.com/users/entrision","html_url":"https://github.com/entrision","followers_url":"https://api.github.com/users/entrision/followers","following_url":"https://api.github.com/users/entrision/following{/other_user}","gists_url":"https://api.github.com/users/entrision/gists{/gist_id}","starred_url":"https://api.github.com/users/entrision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entrision/subscriptions","organizations_url":"https://api.github.com/users/entrision/orgs","repos_url":"https://api.github.com/users/entrision/repos","events_url":"https://api.github.com/users/entrision/events{/privacy}","received_events_url":"https://api.github.com/users/entrision/received_events","type":"Organization","site_admin":false},"repo":{"id":29551422,"name":"lineup","full_name":"entrision/lineup","owner":{"login":"entrision","id":4155190,"avatar_url":"https://avatars.githubusercontent.com/u/4155190?v=3","gravatar_id":"","url":"https://api.github.com/users/entrision","html_url":"https://github.com/entrision","followers_url":"https://api.github.com/users/entrision/followers","following_url":"https://api.github.com/users/entrision/following{/other_user}","gists_url":"https://api.github.com/users/entrision/gists{/gist_id}","starred_url":"https://api.github.com/users/entrision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entrision/subscriptions","organizations_url":"https://api.github.com/users/entrision/orgs","repos_url":"https://api.github.com/users/entrision/repos","events_url":"https://api.github.com/users/entrision/events{/privacy}","received_events_url":"https://api.github.com/users/entrision/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/entrision/lineup","description":"","fork":false,"url":"https://api.github.com/repos/entrision/lineup","forks_url":"https://api.github.com/repos/entrision/lineup/forks","keys_url":"https://api.github.com/repos/entrision/lineup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/entrision/lineup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/entrision/lineup/teams","hooks_url":"https://api.github.com/repos/entrision/lineup/hooks","issue_events_url":"https://api.github.com/repos/entrision/lineup/issues/events{/number}","events_url":"https://api.github.com/repos/entrision/lineup/events","assignees_url":"https://api.github.com/repos/entrision/lineup/assignees{/user}","branches_url":"https://api.github.com/repos/entrision/lineup/branches{/branch}","tags_url":"https://api.github.com/repos/entrision/lineup/tags","blobs_url":"https://api.github.com/repos/entrision/lineup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/entrision/lineup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/entrision/lineup/git/refs{/sha}","trees_url":"https://api.github.com/repos/entrision/lineup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/entrision/lineup/statuses/{sha}","languages_url":"https://api.github.com/repos/entrision/lineup/languages","stargazers_url":"https://api.github.com/repos/entrision/lineup/stargazers","contributors_url":"https://api.github.com/repos/entrision/lineup/contributors","subscribers_url":"https://api.github.com/repos/entrision/lineup/subscribers","subscription_url":"https://api.github.com/repos/entrision/lineup/subscription","commits_url":"https://api.github.com/repos/entrision/lineup/commits{/sha}","git_commits_url":"https://api.github.com/repos/entrision/lineup/git/commits{/sha}","comments_url":"https://api.github.com/repos/entrision/lineup/comments{/number}","issue_comment_url":"https://api.github.com/repos/entrision/lineup/issues/comments{/number}","contents_url":"https://api.github.com/repos/entrision/lineup/contents/{+path}","compare_url":"https://api.github.com/repos/entrision/lineup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/entrision/lineup/merges","archive_url":"https://api.github.com/repos/entrision/lineup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/entrision/lineup/downloads","issues_url":"https://api.github.com/repos/entrision/lineup/issues{/number}","pulls_url":"https://api.github.com/repos/entrision/lineup/pulls{/number}","milestones_url":"https://api.github.com/repos/entrision/lineup/milestones{/number}","notifications_url":"https://api.github.com/repos/entrision/lineup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/entrision/lineup/labels{/name}","releases_url":"https://api.github.com/repos/entrision/lineup/releases{/id}","created_at":"2015-01-20T20:51:43Z","updated_at":"2015-02-18T16:45:48Z","pushed_at":"2015-03-04T14:50:32Z","git_url":"git://github.com/entrision/lineup.git","ssh_url":"git@github.com:entrision/lineup.git","clone_url":"https://github.com/entrision/lineup.git","svn_url":"https://github.com/entrision/lineup","homepage":null,"size":251,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"entrision:master","ref":"master","sha":"3b8e3bda6267e40cdf6a801153af7dc38353f56d","user":{"login":"entrision","id":4155190,"avatar_url":"https://avatars.githubusercontent.com/u/4155190?v=3","gravatar_id":"","url":"https://api.github.com/users/entrision","html_url":"https://github.com/entrision","followers_url":"https://api.github.com/users/entrision/followers","following_url":"https://api.github.com/users/entrision/following{/other_user}","gists_url":"https://api.github.com/users/entrision/gists{/gist_id}","starred_url":"https://api.github.com/users/entrision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entrision/subscriptions","organizations_url":"https://api.github.com/users/entrision/orgs","repos_url":"https://api.github.com/users/entrision/repos","events_url":"https://api.github.com/users/entrision/events{/privacy}","received_events_url":"https://api.github.com/users/entrision/received_events","type":"Organization","site_admin":false},"repo":{"id":29551422,"name":"lineup","full_name":"entrision/lineup","owner":{"login":"entrision","id":4155190,"avatar_url":"https://avatars.githubusercontent.com/u/4155190?v=3","gravatar_id":"","url":"https://api.github.com/users/entrision","html_url":"https://github.com/entrision","followers_url":"https://api.github.com/users/entrision/followers","following_url":"https://api.github.com/users/entrision/following{/other_user}","gists_url":"https://api.github.com/users/entrision/gists{/gist_id}","starred_url":"https://api.github.com/users/entrision/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entrision/subscriptions","organizations_url":"https://api.github.com/users/entrision/orgs","repos_url":"https://api.github.com/users/entrision/repos","events_url":"https://api.github.com/users/entrision/events{/privacy}","received_events_url":"https://api.github.com/users/entrision/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/entrision/lineup","description":"","fork":false,"url":"https://api.github.com/repos/entrision/lineup","forks_url":"https://api.github.com/repos/entrision/lineup/forks","keys_url":"https://api.github.com/repos/entrision/lineup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/entrision/lineup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/entrision/lineup/teams","hooks_url":"https://api.github.com/repos/entrision/lineup/hooks","issue_events_url":"https://api.github.com/repos/entrision/lineup/issues/events{/number}","events_url":"https://api.github.com/repos/entrision/lineup/events","assignees_url":"https://api.github.com/repos/entrision/lineup/assignees{/user}","branches_url":"https://api.github.com/repos/entrision/lineup/branches{/branch}","tags_url":"https://api.github.com/repos/entrision/lineup/tags","blobs_url":"https://api.github.com/repos/entrision/lineup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/entrision/lineup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/entrision/lineup/git/refs{/sha}","trees_url":"https://api.github.com/repos/entrision/lineup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/entrision/lineup/statuses/{sha}","languages_url":"https://api.github.com/repos/entrision/lineup/languages","stargazers_url":"https://api.github.com/repos/entrision/lineup/stargazers","contributors_url":"https://api.github.com/repos/entrision/lineup/contributors","subscribers_url":"https://api.github.com/repos/entrision/lineup/subscribers","subscription_url":"https://api.github.com/repos/entrision/lineup/subscription","commits_url":"https://api.github.com/repos/entrision/lineup/commits{/sha}","git_commits_url":"https://api.github.com/repos/entrision/lineup/git/commits{/sha}","comments_url":"https://api.github.com/repos/entrision/lineup/comments{/number}","issue_comment_url":"https://api.github.com/repos/entrision/lineup/issues/comments{/number}","contents_url":"https://api.github.com/repos/entrision/lineup/contents/{+path}","compare_url":"https://api.github.com/repos/entrision/lineup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/entrision/lineup/merges","archive_url":"https://api.github.com/repos/entrision/lineup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/entrision/lineup/downloads","issues_url":"https://api.github.com/repos/entrision/lineup/issues{/number}","pulls_url":"https://api.github.com/repos/entrision/lineup/pulls{/number}","milestones_url":"https://api.github.com/repos/entrision/lineup/milestones{/number}","notifications_url":"https://api.github.com/repos/entrision/lineup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/entrision/lineup/labels{/name}","releases_url":"https://api.github.com/repos/entrision/lineup/releases{/id}","created_at":"2015-01-20T20:51:43Z","updated_at":"2015-02-18T16:45:48Z","pushed_at":"2015-03-04T14:50:32Z","git_url":"git://github.com/entrision/lineup.git","ssh_url":"git@github.com:entrision/lineup.git","clone_url":"https://github.com/entrision/lineup.git","svn_url":"https://github.com/entrision/lineup","homepage":null,"size":251,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/entrision/lineup/pulls/2"},"html":{"href":"https://github.com/entrision/lineup/pull/2"},"issue":{"href":"https://api.github.com/repos/entrision/lineup/issues/2"},"comments":{"href":"https://api.github.com/repos/entrision/lineup/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/entrision/lineup/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/entrision/lineup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/entrision/lineup/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/entrision/lineup/statuses/29a9009e699f452814bb1ebbea31f2c5499fdcea"}}}}