{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/148","repository_url":"https://api.github.com/repos/rails-api/active_model_serializers","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/148/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/148/events","html_url":"https://github.com/rails-api/active_model_serializers/issues/148","id":8359439,"number":148,"title":"Serializing draper decorators","user":{"login":"mattiassvedhem","id":721122,"avatar_url":"https://avatars.githubusercontent.com/u/721122?v=3","gravatar_id":"","url":"https://api.github.com/users/mattiassvedhem","html_url":"https://github.com/mattiassvedhem","followers_url":"https://api.github.com/users/mattiassvedhem/followers","following_url":"https://api.github.com/users/mattiassvedhem/following{/other_user}","gists_url":"https://api.github.com/users/mattiassvedhem/gists{/gist_id}","starred_url":"https://api.github.com/users/mattiassvedhem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattiassvedhem/subscriptions","organizations_url":"https://api.github.com/users/mattiassvedhem/orgs","repos_url":"https://api.github.com/users/mattiassvedhem/repos","events_url":"https://api.github.com/users/mattiassvedhem/events{/privacy}","received_events_url":"https://api.github.com/users/mattiassvedhem/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2012-11-14T16:36:09Z","updated_at":"2016-02-15T10:09:35Z","closed_at":"2012-11-20T15:43:10Z","body":"When serializing a Draper Decorator:\n\n```\nclass SomeDecorator < Draper::Base\n  decorates :some\n\n  def title\n    # Something here\n  end\nend\n```\n\n```\nsome = SomeDecorator.find(params[:id])\nrender json: some, serializer: SomeSerializer\n```\n\n```\nclass SomeSerializer < ActiveModel::Serializer\n  attributes :title\nend\n```\n\nThe serializer is calling the models underlying ```title``` method. However if I override ```title``` in the serializer, like this:\n\n```\ndef title\n  object.title\nend\n```\n\nThe serializer is calling the title method on the SomeDecorator object. \n\nI guess the attributes method is sending the method calls to the underlying ```model_class``` object . Is this correct? And if so shouldn't attributes also send the methods to the passed object instead of the \"magically\" resolved ```model_class``` object?"},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/184143550","html_url":"https://github.com/rails-api/active_model_serializers/issues/148#issuecomment-184143550","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/148","id":184143550,"user":{"login":"patrickgordon","id":3182530,"avatar_url":"https://avatars.githubusercontent.com/u/3182530?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickgordon","html_url":"https://github.com/patrickgordon","followers_url":"https://api.github.com/users/patrickgordon/followers","following_url":"https://api.github.com/users/patrickgordon/following{/other_user}","gists_url":"https://api.github.com/users/patrickgordon/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickgordon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickgordon/subscriptions","organizations_url":"https://api.github.com/users/patrickgordon/orgs","repos_url":"https://api.github.com/users/patrickgordon/repos","events_url":"https://api.github.com/users/patrickgordon/events{/privacy}","received_events_url":"https://api.github.com/users/patrickgordon/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T10:09:35Z","updated_at":"2016-02-15T10:09:35Z","body":"I know this issue is almost 4 years old but... did you ever actually manage to do this?"}}