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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…