{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongoid/pulls/comments/43019002","id":43019002,"diff_hunk":"@@ -231,7 +231,11 @@ def included?(fields)\n       # @since 2.4.4\n       def evaluated_default(doc)\n         if default_val.respond_to?(:call)\n-          evaluate_default_proc(doc)\n+          begin\n+            evaluate_default_proc(doc)\n+          rescue NoMethodError => e\n+            return nil\n+          end","path":"lib/mongoid/fields/standard.rb","position":9,"original_position":9,"commit_id":"cc27344340b7a95f05fbbdb64862b9e9ec7389d7","original_commit_id":"cc27344340b7a95f05fbbdb64862b9e9ec7389d7","user":{"login":"estolfo","id":699369,"avatar_url":"https://avatars.githubusercontent.com/u/699369?v=3","gravatar_id":"","url":"https://api.github.com/users/estolfo","html_url":"https://github.com/estolfo","followers_url":"https://api.github.com/users/estolfo/followers","following_url":"https://api.github.com/users/estolfo/following{/other_user}","gists_url":"https://api.github.com/users/estolfo/gists{/gist_id}","starred_url":"https://api.github.com/users/estolfo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estolfo/subscriptions","organizations_url":"https://api.github.com/users/estolfo/orgs","repos_url":"https://api.github.com/users/estolfo/repos","events_url":"https://api.github.com/users/estolfo/events{/privacy}","received_events_url":"https://api.github.com/users/estolfo/received_events","type":"User","site_admin":false},"body":"We actually need to redesign a little so that methods referencing an association aren't called until after the relation is set on the new object. The initialize method of Document determines the order in which this setup happens but changing the order wouldn't be enough-- we need to change fields.rb to account for a dependency of a certain field on an association.","created_at":"2015-10-26T16:48:06Z","updated_at":"2015-10-26T16:48:06Z","html_url":"https://github.com/mongodb/mongoid/pull/4181#discussion_r43019002","pull_request_url":"https://api.github.com/repos/mongodb/mongoid/pulls/4181","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongoid/pulls/comments/43019002"},"html":{"href":"https://github.com/mongodb/mongoid/pull/4181#discussion_r43019002"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongoid/pulls/4181"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongoid/pulls/4181","id":48580130,"html_url":"https://github.com/mongodb/mongoid/pull/4181","diff_url":"https://github.com/mongodb/mongoid/pull/4181.diff","patch_url":"https://github.com/mongodb/mongoid/pull/4181.patch","issue_url":"https://api.github.com/repos/mongodb/mongoid/issues/4181","number":4181,"state":"open","locked":false,"title":"MONGOID-3267 Using relations as a default values","user":{"login":"sivagollapalli","id":280199,"avatar_url":"https://avatars.githubusercontent.com/u/280199?v=3","gravatar_id":"","url":"https://api.github.com/users/sivagollapalli","html_url":"https://github.com/sivagollapalli","followers_url":"https://api.github.com/users/sivagollapalli/followers","following_url":"https://api.github.com/users/sivagollapalli/following{/other_user}","gists_url":"https://api.github.com/users/sivagollapalli/gists{/gist_id}","starred_url":"https://api.github.com/users/sivagollapalli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivagollapalli/subscriptions","organizations_url":"https://api.github.com/users/sivagollapalli/orgs","repos_url":"https://api.github.com/users/sivagollapalli/repos","events_url":"https://api.github.com/users/sivagollapalli/events{/privacy}","received_events_url":"https://api.github.com/users/sivagollapalli/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-23T13:31:56Z","updated_at":"2015-10-26T16:48:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"460590bc1940cae2df8f75dbb1382d9ccab4e561","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongoid/pulls/4181/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongoid/pulls/4181/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongoid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/mongoid/issues/4181/comments","statuses_url":"https://api.github.com/repos/mongodb/mongoid/statuses/cc27344340b7a95f05fbbdb64862b9e9ec7389d7","head":{"label":"joshsoftware:issue_3267","ref":"issue_3267","sha":"cc27344340b7a95f05fbbdb64862b9e9ec7389d7","user":{"login":"joshsoftware","id":130756,"avatar_url":"https://avatars.githubusercontent.com/u/130756?v=3","gravatar_id":"","url":"https://api.github.com/users/joshsoftware","html_url":"https://github.com/joshsoftware","followers_url":"https://api.github.com/users/joshsoftware/followers","following_url":"https://api.github.com/users/joshsoftware/following{/other_user}","gists_url":"https://api.github.com/users/joshsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/joshsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshsoftware/subscriptions","organizations_url":"https://api.github.com/users/joshsoftware/orgs","repos_url":"https://api.github.com/users/joshsoftware/repos","events_url":"https://api.github.com/users/joshsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/joshsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":42863717,"name":"mongoid","full_name":"joshsoftware/mongoid","owner":{"login":"joshsoftware","id":130756,"avatar_url":"https://avatars.githubusercontent.com/u/130756?v=3","gravatar_id":"","url":"https://api.github.com/users/joshsoftware","html_url":"https://github.com/joshsoftware","followers_url":"https://api.github.com/users/joshsoftware/followers","following_url":"https://api.github.com/users/joshsoftware/following{/other_user}","gists_url":"https://api.github.com/users/joshsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/joshsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshsoftware/subscriptions","organizations_url":"https://api.github.com/users/joshsoftware/orgs","repos_url":"https://api.github.com/users/joshsoftware/repos","events_url":"https://api.github.com/users/joshsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/joshsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joshsoftware/mongoid","description":"Ruby ODM framework for MongoDB","fork":true,"url":"https://api.github.com/repos/joshsoftware/mongoid","forks_url":"https://api.github.com/repos/joshsoftware/mongoid/forks","keys_url":"https://api.github.com/repos/joshsoftware/mongoid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joshsoftware/mongoid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joshsoftware/mongoid/teams","hooks_url":"https://api.github.com/repos/joshsoftware/mongoid/hooks","issue_events_url":"https://api.github.com/repos/joshsoftware/mongoid/issues/events{/number}","events_url":"https://api.github.com/repos/joshsoftware/mongoid/events","assignees_url":"https://api.github.com/repos/joshsoftware/mongoid/assignees{/user}","branches_url":"https://api.github.com/repos/joshsoftware/mongoid/branches{/branch}","tags_url":"https://api.github.com/repos/joshsoftware/mongoid/tags","blobs_url":"https://api.github.com/repos/joshsoftware/mongoid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joshsoftware/mongoid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joshsoftware/mongoid/git/refs{/sha}","trees_url":"https://api.github.com/repos/joshsoftware/mongoid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joshsoftware/mongoid/statuses/{sha}","languages_url":"https://api.github.com/repos/joshsoftware/mongoid/languages","stargazers_url":"https://api.github.com/repos/joshsoftware/mongoid/stargazers","contributors_url":"https://api.github.com/repos/joshsoftware/mongoid/contributors","subscribers_url":"https://api.github.com/repos/joshsoftware/mongoid/subscribers","subscription_url":"https://api.github.com/repos/joshsoftware/mongoid/subscription","commits_url":"https://api.github.com/repos/joshsoftware/mongoid/commits{/sha}","git_commits_url":"https://api.github.com/repos/joshsoftware/mongoid/git/commits{/sha}","comments_url":"https://api.github.com/repos/joshsoftware/mongoid/comments{/number}","issue_comment_url":"https://api.github.com/repos/joshsoftware/mongoid/issues/comments{/number}","contents_url":"https://api.github.com/repos/joshsoftware/mongoid/contents/{+path}","compare_url":"https://api.github.com/repos/joshsoftware/mongoid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joshsoftware/mongoid/merges","archive_url":"https://api.github.com/repos/joshsoftware/mongoid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joshsoftware/mongoid/downloads","issues_url":"https://api.github.com/repos/joshsoftware/mongoid/issues{/number}","pulls_url":"https://api.github.com/repos/joshsoftware/mongoid/pulls{/number}","milestones_url":"https://api.github.com/repos/joshsoftware/mongoid/milestones{/number}","notifications_url":"https://api.github.com/repos/joshsoftware/mongoid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joshsoftware/mongoid/labels{/name}","releases_url":"https://api.github.com/repos/joshsoftware/mongoid/releases{/id}","created_at":"2015-09-21T12:01:44Z","updated_at":"2015-09-21T12:01:49Z","pushed_at":"2015-10-23T13:29:20Z","git_url":"git://github.com/joshsoftware/mongoid.git","ssh_url":"git@github.com:joshsoftware/mongoid.git","clone_url":"https://github.com/joshsoftware/mongoid.git","svn_url":"https://github.com/joshsoftware/mongoid","homepage":"http://mongoid.org","size":13625,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"mongodb:master","ref":"master","sha":"af6f35947292c4d498ba0f30e38c6860fcbcae58","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":309009,"name":"mongoid","full_name":"mongodb/mongoid","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongoid","description":"Ruby ODM framework for MongoDB","fork":false,"url":"https://api.github.com/repos/mongodb/mongoid","forks_url":"https://api.github.com/repos/mongodb/mongoid/forks","keys_url":"https://api.github.com/repos/mongodb/mongoid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongoid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongoid/teams","hooks_url":"https://api.github.com/repos/mongodb/mongoid/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongoid/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongoid/events","assignees_url":"https://api.github.com/repos/mongodb/mongoid/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongoid/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongoid/tags","blobs_url":"https://api.github.com/repos/mongodb/mongoid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongoid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongoid/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongoid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongoid/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongoid/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongoid/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongoid/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongoid/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongoid/subscription","commits_url":"https://api.github.com/repos/mongodb/mongoid/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongoid/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongoid/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongoid/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/mongoid/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongoid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongoid/merges","archive_url":"https://api.github.com/repos/mongodb/mongoid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongoid/downloads","issues_url":"https://api.github.com/repos/mongodb/mongoid/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongoid/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongoid/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongoid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongoid/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongoid/releases{/id}","created_at":"2009-09-16T16:24:56Z","updated_at":"2015-10-22T17:20:02Z","pushed_at":"2015-10-26T16:36:20Z","git_url":"git://github.com/mongodb/mongoid.git","ssh_url":"git@github.com:mongodb/mongoid.git","clone_url":"https://github.com/mongodb/mongoid.git","svn_url":"https://github.com/mongodb/mongoid","homepage":"http://mongoid.org","size":29182,"stargazers_count":3268,"watchers_count":3268,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1138,"mirror_url":null,"open_issues_count":304,"forks":1138,"open_issues":304,"watchers":3268,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongoid/pulls/4181"},"html":{"href":"https://github.com/mongodb/mongoid/pull/4181"},"issue":{"href":"https://api.github.com/repos/mongodb/mongoid/issues/4181"},"comments":{"href":"https://api.github.com/repos/mongodb/mongoid/issues/4181/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongoid/pulls/4181/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongoid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongoid/pulls/4181/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongoid/statuses/cc27344340b7a95f05fbbdb64862b9e9ec7389d7"}}}}