Pass format options through ActionController::Responder to serializer

13 views
Skip to first unread message

Robin McFee

unread,
Apr 2, 2016, 7:02:43 PM4/2/16
to Ruby on Rails: Core
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

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.


Reply all
Reply to author
Forward
0 new messages