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