title: Rails: do non-ActiveRecord models need to include ActiveModel::Serializers, or just respond to #as_json?
body: <p>Using Rails 3.2, I'm working on an API backed model (not ActiveRecord). I want to be able to call <code>to_json</code> on this model in Rails controllers. After reading through a bunch of the ActiveModel docs I'm still not clear on one thing:</p>
  
  <p>Given a model like this:</p>
  
  <pre><code>class MyModel
    attr_accessor :id, :name
    def initialize(data)
      @id = data[:id]
      @name = data[:name]
    end
  
    def as_json
      {id: @id, name: @name}
    end
  end
  </code></pre>
  
  <p>Should this work as expected, or do I also need to include <code>ActiveModel::Serializers::JSON</code>? I'm having a hard time figuring out where the <code>as_json</code> / <code>to_json</code> methods are normally defined and when Rails calls which ones automatically in different circumstances...</p>
  
  <p>Thanks for any insight!</p>