ActiveRecord::Base provides a JSON serializer which takes an optional 
options argument.

https://github.com/rails/rails/blob/e3ceb28e66ca6e869f8f9778dc42672f48001a90/activemodel/lib/active_model/serializers/json.rb#L88
 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Frails%2Frails%2Fblob%2Fe3ceb28e66ca6e869f8f9778dc42672f48001a90%2Factivemodel%2Flib%2Factive_model%2Fserializers%2Fjson.rb%23L88&sa=D&sntz=1&usg=AFQjCNFqjFtzcFMiZbxzh5S7NcVv-LsuDw>

def as_json(options = nil)

ActionController::Responder doesn't allow for passing options to the 
serializer via respond_with. I'd love to add this ability if others would 
find it useful.

https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/metal/responder.rb#L152
 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Frails%2Frails%2Fblob%2F3-2-stable%2Factionpack%2Flib%2Faction_controller%2Fmetal%2Fresponder.rb%23L152&sa=D&sntz=1&usg=AFQjCNHzzvte76FRXdgO_GKa7UD-OCEKGA>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to