{"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/paperclip/pulls/comments/23874127","id":23874127,"diff_hunk":"@@ -64,11 +64,30 @@\n \n     it \"produces defintions for subclasses\" do\n       expected_definitions = { avatar: { yo: 'greeting' } }\n-      Foo = Class.new\n-      Bar = Class.new(Foo)\n-      Paperclip::AttachmentRegistry.register(Foo, :avatar, expected_definitions[:avatar])\n+      foo = Class.new\n+      bar = Class.new(foo)\n+      Paperclip::AttachmentRegistry.register(foo, :avatar, expected_definitions[:avatar])\n+\n+      definitions = Paperclip::AttachmentRegistry.definitions_for(bar)\n+\n+      assert_equal expected_definitions, definitions\n+    end\n+\n+    it \"produces defintions for subclasses but deep merging them\" do\n+      foo_definitions = { avatar: { yo: 'greeting' } }\n+      bar_definitions = { avatar: { ciao: 'greeting' } }\n+      expected_definitions = {\n+        avatar: {\n+          yo: 'greeting',\n+          ciao: 'greeting'\n+         }","path":"spec/paperclip/attachment_registry_spec.rb","position":23,"original_position":23,"commit_id":"c8625946170fe24f3a5b3e27a25c2bb8560dda91","original_commit_id":"c8625946170fe24f3a5b3e27a25c2bb8560dda91","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":"Indent the right brace the same as the start of the line where the left brace is.","created_at":"2015-01-30T21:33:48Z","updated_at":"2015-01-30T21:33:48Z","html_url":"https://github.com/thoughtbot/paperclip/pull/1758#discussion_r23874127","pull_request_url":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/paperclip/pulls/comments/23874127"},"html":{"href":"https://github.com/thoughtbot/paperclip/pull/1758#discussion_r23874127"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758","id":28395021,"html_url":"https://github.com/thoughtbot/paperclip/pull/1758","diff_url":"https://github.com/thoughtbot/paperclip/pull/1758.diff","patch_url":"https://github.com/thoughtbot/paperclip/pull/1758.patch","issue_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1758","number":1758,"state":"open","locked":false,"title":"Add the ability to deep_merge! Attachment definitions","user":{"login":"cavi21","id":146249,"avatar_url":"https://avatars.githubusercontent.com/u/146249?v=3","gravatar_id":"","url":"https://api.github.com/users/cavi21","html_url":"https://github.com/cavi21","followers_url":"https://api.github.com/users/cavi21/followers","following_url":"https://api.github.com/users/cavi21/following{/other_user}","gists_url":"https://api.github.com/users/cavi21/gists{/gist_id}","starred_url":"https://api.github.com/users/cavi21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cavi21/subscriptions","organizations_url":"https://api.github.com/users/cavi21/orgs","repos_url":"https://api.github.com/users/cavi21/repos","events_url":"https://api.github.com/users/cavi21/events{/privacy}","received_events_url":"https://api.github.com/users/cavi21/received_events","type":"User","site_admin":false},"body":"Instead of just merging them.\r\n\r\nThis pull request is intended to try to \"improve\" the feature that was included in the #1331 and also mentioned in #1330 and #1373 in regards to the [attachement_definition](https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/has_attached_file.rb#L103) method and the call to the [definitions_for] (https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/attachment_registry.rb#L53) method that merge together the all the ancestors definitions.\r\n\r\n#### Why this change? \r\nBecause if there are different definitions for the same attachment name, with the **merge!** method the ancestor ones override the actual ones, I included the test to showcase this.\r\n\r\nI make use of the **deep_merge!** method that I know that it's Rails specific, but checking the dependencies of paperclip and reading the [CONTRIBUTING.md](https://github.com/thoughtbot/paperclip/blob/master/CONTRIBUTING.md) (that said _Use Rails idioms and helpers_) file I thought that maybe is better to use a Rails method and write some ruby helper for the deep merging feature, please let me know if you prefer another approach for this.\r\n\r\nThanks and let me know if there is anything that I missed.\r\n","created_at":"2015-01-30T21:33:44Z","updated_at":"2015-01-30T21:33:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"880b4c9d391a244cd102b3e30dc402c422b0202c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/paperclip/pulls/comments/{number}","comments_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/1758/comments","statuses_url":"https://api.github.com/repos/thoughtbot/paperclip/statuses/c8625946170fe24f3a5b3e27a25c2bb8560dda91","head":{"label":"cavi21:fix_attachment_definitions","ref":"fix_attachment_definitions","sha":"c8625946170fe24f3a5b3e27a25c2bb8560dda91","user":{"login":"cavi21","id":146249,"avatar_url":"https://avatars.githubusercontent.com/u/146249?v=3","gravatar_id":"","url":"https://api.github.com/users/cavi21","html_url":"https://github.com/cavi21","followers_url":"https://api.github.com/users/cavi21/followers","following_url":"https://api.github.com/users/cavi21/following{/other_user}","gists_url":"https://api.github.com/users/cavi21/gists{/gist_id}","starred_url":"https://api.github.com/users/cavi21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cavi21/subscriptions","organizations_url":"https://api.github.com/users/cavi21/orgs","repos_url":"https://api.github.com/users/cavi21/repos","events_url":"https://api.github.com/users/cavi21/events{/privacy}","received_events_url":"https://api.github.com/users/cavi21/received_events","type":"User","site_admin":false},"repo":{"id":30088087,"name":"paperclip","full_name":"cavi21/paperclip","owner":{"login":"cavi21","id":146249,"avatar_url":"https://avatars.githubusercontent.com/u/146249?v=3","gravatar_id":"","url":"https://api.github.com/users/cavi21","html_url":"https://github.com/cavi21","followers_url":"https://api.github.com/users/cavi21/followers","following_url":"https://api.github.com/users/cavi21/following{/other_user}","gists_url":"https://api.github.com/users/cavi21/gists{/gist_id}","starred_url":"https://api.github.com/users/cavi21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cavi21/subscriptions","organizations_url":"https://api.github.com/users/cavi21/orgs","repos_url":"https://api.github.com/users/cavi21/repos","events_url":"https://api.github.com/users/cavi21/events{/privacy}","received_events_url":"https://api.github.com/users/cavi21/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cavi21/paperclip","description":"Easy file attachment management for ActiveRecord","fork":true,"url":"https://api.github.com/repos/cavi21/paperclip","forks_url":"https://api.github.com/repos/cavi21/paperclip/forks","keys_url":"https://api.github.com/repos/cavi21/paperclip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cavi21/paperclip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cavi21/paperclip/teams","hooks_url":"https://api.github.com/repos/cavi21/paperclip/hooks","issue_events_url":"https://api.github.com/repos/cavi21/paperclip/issues/events{/number}","events_url":"https://api.github.com/repos/cavi21/paperclip/events","assignees_url":"https://api.github.com/repos/cavi21/paperclip/assignees{/user}","branches_url":"https://api.github.com/repos/cavi21/paperclip/branches{/branch}","tags_url":"https://api.github.com/repos/cavi21/paperclip/tags","blobs_url":"https://api.github.com/repos/cavi21/paperclip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cavi21/paperclip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cavi21/paperclip/git/refs{/sha}","trees_url":"https://api.github.com/repos/cavi21/paperclip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cavi21/paperclip/statuses/{sha}","languages_url":"https://api.github.com/repos/cavi21/paperclip/languages","stargazers_url":"https://api.github.com/repos/cavi21/paperclip/stargazers","contributors_url":"https://api.github.com/repos/cavi21/paperclip/contributors","subscribers_url":"https://api.github.com/repos/cavi21/paperclip/subscribers","subscription_url":"https://api.github.com/repos/cavi21/paperclip/subscription","commits_url":"https://api.github.com/repos/cavi21/paperclip/commits{/sha}","git_commits_url":"https://api.github.com/repos/cavi21/paperclip/git/commits{/sha}","comments_url":"https://api.github.com/repos/cavi21/paperclip/comments{/number}","issue_comment_url":"https://api.github.com/repos/cavi21/paperclip/issues/comments/{number}","contents_url":"https://api.github.com/repos/cavi21/paperclip/contents/{+path}","compare_url":"https://api.github.com/repos/cavi21/paperclip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cavi21/paperclip/merges","archive_url":"https://api.github.com/repos/cavi21/paperclip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cavi21/paperclip/downloads","issues_url":"https://api.github.com/repos/cavi21/paperclip/issues{/number}","pulls_url":"https://api.github.com/repos/cavi21/paperclip/pulls{/number}","milestones_url":"https://api.github.com/repos/cavi21/paperclip/milestones{/number}","notifications_url":"https://api.github.com/repos/cavi21/paperclip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cavi21/paperclip/labels{/name}","releases_url":"https://api.github.com/repos/cavi21/paperclip/releases{/id}","created_at":"2015-01-30T19:49:29Z","updated_at":"2015-01-30T19:49:30Z","pushed_at":"2015-01-30T20:57:07Z","git_url":"git://github.com/cavi21/paperclip.git","ssh_url":"git@github.com:cavi21/paperclip.git","clone_url":"https://github.com/cavi21/paperclip.git","svn_url":"https://github.com/cavi21/paperclip","homepage":"http://thoughtbot.com/open-source","size":9768,"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":"thoughtbot:master","ref":"master","sha":"c46b40b973a66eb8ac454c1d22e5df15da66d7c3","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":8393,"name":"paperclip","full_name":"thoughtbot/paperclip","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/paperclip","description":"Easy file attachment management for ActiveRecord","fork":false,"url":"https://api.github.com/repos/thoughtbot/paperclip","forks_url":"https://api.github.com/repos/thoughtbot/paperclip/forks","keys_url":"https://api.github.com/repos/thoughtbot/paperclip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/paperclip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/paperclip/teams","hooks_url":"https://api.github.com/repos/thoughtbot/paperclip/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/paperclip/events","assignees_url":"https://api.github.com/repos/thoughtbot/paperclip/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/paperclip/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/paperclip/tags","blobs_url":"https://api.github.com/repos/thoughtbot/paperclip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/paperclip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/paperclip/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/paperclip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/paperclip/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/paperclip/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/paperclip/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/paperclip/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/paperclip/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/paperclip/subscription","commits_url":"https://api.github.com/repos/thoughtbot/paperclip/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/paperclip/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/paperclip/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/paperclip/issues/comments/{number}","contents_url":"https://api.github.com/repos/thoughtbot/paperclip/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/paperclip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/paperclip/merges","archive_url":"https://api.github.com/repos/thoughtbot/paperclip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/paperclip/downloads","issues_url":"https://api.github.com/repos/thoughtbot/paperclip/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/paperclip/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/paperclip/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/paperclip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/paperclip/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/paperclip/releases{/id}","created_at":"2008-04-10T19:58:20Z","updated_at":"2015-01-30T20:09:59Z","pushed_at":"2015-01-12T03:41:08Z","git_url":"git://github.com/thoughtbot/paperclip.git","ssh_url":"git@github.com:thoughtbot/paperclip.git","clone_url":"https://github.com/thoughtbot/paperclip.git","svn_url":"https://github.com/thoughtbot/paperclip","homepage":"http://thoughtbot.com/open-source","size":9768,"stargazers_count":6610,"watchers_count":6610,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1450,"mirror_url":null,"open_issues_count":258,"forks":1450,"open_issues":258,"watchers":6610,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758"},"html":{"href":"https://github.com/thoughtbot/paperclip/pull/1758"},"issue":{"href":"https://api.github.com/repos/thoughtbot/paperclip/issues/1758"},"comments":{"href":"https://api.github.com/repos/thoughtbot/paperclip/issues/1758/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/paperclip/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/paperclip/pulls/1758/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/paperclip/statuses/c8625946170fe24f3a5b3e27a25c2bb8560dda91"}}}}