title: Rails active model serializer - attribute alias
body: <p>I'm integrating an Angular 2 application with Rails 5.1 API back-end.</p>
  
  <p>I have a <code>Comment</code> model with <code>message</code> and <code>date</code> attributes in my Angular model. However in my Rails model for <code>Comment</code>, along with <code>message</code> attribute I have <code>created_at</code> and <code>updated_at</code> attributes automatically provided by <code>ActiveRecord::Migration</code> via <code>t.timestamps</code>. </p>
  
  <p>I'm using <code>ActiveModel::Serializer</code> to have finer control on API reponses and in my <code>comment_serializer</code> I want to include <code>date</code> in place of <code>created_at</code> in API responses for each comment in <code>GET /comments</code>, <code>GET /comments/:id</code> etc. so that the Angular model need not be changed - how do I go about this assuming this is the right approach ? </p>
  
  <p>Also when I'm adding a comment from the Angular client I want the <code>date</code> attribute in <code>Comment</code> model to be mapped to <code>created_at</code> in the corresponding <code>Comment</code> model in Rails - how do I go about this ?  </p>