Skip to content

Document passing arbitrary options to serializer #1506

Closed
@bf4

Description

@bf4

See discussion in

But is basically the example by @jszwedko

PostController

...
  def show 
    render json: @post, user_id: 1234
  end
...

PostSerializer

...
  def my_comments
    Comments.where(user_id: instance_options[:user_id], post_id: object.id)
  end
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions