title: active model serializer not working with rails-api gem
body: <p>I am using rails-api gem in my project for json api, and for that purpose I used active model serializer gem for serializing my objects but some how the objects are not being serialized using active model serializer. </p>
  
  <p>I have a MessageSerializer inside of my serializers folder</p>
  
  <pre><code>class MessageSerializer &lt; ActiveModel::Serializer
    attributes :id, :sender_id, :recipient_id, :sender_type, :subj, :body, :status, :sender
  
    def sender
      object.user.try('username')
    end
  end
  </code></pre>
  
  <p>And my messages controller is as follows</p>
  
  <pre><code>class Api::MessagesController &lt; Api::BaseController
  
    def index
      @messages = current_user.incoming_messages
      render json: @messages, serializer: MessageSerializer
    end
  
  end
  </code></pre>
  
  <p>But the problem is that the serialized object thrown to client contains all the fields in message model ie; it contains created_at, updated_at fields too.</p>
  
  <p>Seems like its not using serializer.</p>
  
  <p>What might have gone wrong?
  I searched a lot about it but didn't found any post that helped me.</p>
  
  <p>Thanks</p>