I'm using active model serializer. I have a model event which has_many activities.
I want to return the event with the first n activities. I think I should pass the params n to the event serializer.
In version ~> 0.10.0
you need to use @instance_options
. Using @Jon Gold example from above:
# controller def action render json: @model, option_name: value end # serializer class ModelSerializer::ActiveModel::Serializer def some_method puts @instance_options[:option_name] end end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With