0

I would need to filter the records to include for has_many relation with the params that are passed to the serializer. The object_method_name option is invoking a method in the model, but how can I pass the params to the method?

Or is there a way to use a Proc for getting the records for has_many relation? Couldn't find any documentation for that at least.

Mika
  • 1,419
  • 18
  • 37

1 Answers1

1

Found it. You can give a block to it

has_many :records do |object, params|
  object.my_records(params)
end
Mika
  • 1,419
  • 18
  • 37