title: Ruby on Rails "render json:" ignoring alias_attribute
body: <p>I have the following code in my <strong>account.rb</strong> model file:</p>
  
  <pre><code>class Account &lt; ActiveRecord::Base
    alias_attribute :id, :accountID
    alias_attribute :name, :awzAccountName
    alias_attribute :description, :awzAccountDescription
  end
  </code></pre>
  
  <p>And the following code in the <strong>index</strong> method from my <strong>accounts_controller.rb</strong> file:</p>
  
  <pre><code>def index
      @accounts = Account.all
  
      if params["page"]
        page = params["page"]
        items_per_page = params["per_page"]
  
        render :json =&gt; {:total =&gt; @accounts.count,:accounts =&gt; @accounts.page(page).per(items_per_page) }
      else
        render json: @accounts
      end
  end
  </code></pre>
  
  <p>As expected, <code>render json: @accounts</code> returns a result set that contains the <code>alias_attribute</code> column names defined in the model file.  However, the <code>render :json =&gt; {:total =&gt; @accounts.count,:accounts =&gt; @accounts.page(page).per(items_per_page) }</code> code returns a result set that contains the original column names.  Is there any way to change this so that the <code>alias_attribute</code> column names are used?</p>