{"action":"created","issue":{"url":"https://api.github.com/repos/amatsuda/active_decorator/issues/8","labels_url":"https://api.github.com/repos/amatsuda/active_decorator/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/amatsuda/active_decorator/issues/8/comments","events_url":"https://api.github.com/repos/amatsuda/active_decorator/issues/8/events","html_url":"https://github.com/amatsuda/active_decorator/pull/8","id":4796164,"number":8,"title":"Decorate associations of a decorated object","user":{"login":"ronen","id":125620,"avatar_url":"https://avatars.githubusercontent.com/u/125620?v=3","gravatar_id":"","url":"https://api.github.com/users/ronen","html_url":"https://github.com/ronen","followers_url":"https://api.github.com/users/ronen/followers","following_url":"https://api.github.com/users/ronen/following{/other_user}","gists_url":"https://api.github.com/users/ronen/gists{/gist_id}","starred_url":"https://api.github.com/users/ronen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronen/subscriptions","organizations_url":"https://api.github.com/users/ronen/orgs","repos_url":"https://api.github.com/users/ronen/repos","events_url":"https://api.github.com/users/ronen/events{/privacy}","received_events_url":"https://api.github.com/users/ronen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2012-05-29T14:25:27Z","updated_at":"2015-03-30T15:00:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/amatsuda/active_decorator/pulls/8","html_url":"https://github.com/amatsuda/active_decorator/pull/8","diff_url":"https://github.com/amatsuda/active_decorator/pull/8.diff","patch_url":"https://github.com/amatsuda/active_decorator/pull/8.patch"},"body":"Hi, I just started using active_decorator, it seems great, thanks for making it!\n\nBut I quickly came across a feature that I needed: the ability to access an association's decorations.  That is, considering the `Book` and `Author` classes in `spec/fake_app` --  I wanted to create a method in `BookDecoration` like:\n\n    def attribution\n         \"#{title}, by #{author.capitalized_name}\"\n    end\n\nwhich uses `AuthorDecoration#capitalized_name`.  But typically although `self` is decorated, `se;f.author` is not decorated so the method fails.\n\nThe solution I came up with is, after decorating an object, to introspect on all associations and override their methods in the object's singleton class, to call super() and return the decorated result.   This approach seems to work, and has the feature of being \"lazy\" in that the associated objects only get decorated if/when they're accessed.  I don't think it will conflict with anything else, though I'll admit I haven't put very deep thought into it.   \n\nCheers\n"},"comment":{"url":"https://api.github.com/repos/amatsuda/active_decorator/issues/comments/87714375","html_url":"https://github.com/amatsuda/active_decorator/pull/8#issuecomment-87714375","issue_url":"https://api.github.com/repos/amatsuda/active_decorator/issues/8","id":87714375,"user":{"login":"vala","id":792772,"avatar_url":"https://avatars.githubusercontent.com/u/792772?v=3","gravatar_id":"","url":"https://api.github.com/users/vala","html_url":"https://github.com/vala","followers_url":"https://api.github.com/users/vala/followers","following_url":"https://api.github.com/users/vala/following{/other_user}","gists_url":"https://api.github.com/users/vala/gists{/gist_id}","starred_url":"https://api.github.com/users/vala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vala/subscriptions","organizations_url":"https://api.github.com/users/vala/orgs","repos_url":"https://api.github.com/users/vala/repos","events_url":"https://api.github.com/users/vala/events{/privacy}","received_events_url":"https://api.github.com/users/vala/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T15:00:28Z","updated_at":"2015-03-30T15:00:28Z","body":"@amatsuda could you please review this PR too ?"}}