Skip to content

Constructor does not pass down the options to serializer #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Constructor does not pass down the options to serializer #1286

wants to merge 1 commit into from

Conversation

vasilakisfil
Copy link
Contributor

This passes down the options for the serializer to the serializer:

render json: @videos.limit(1), each_serializer: VideoSerializer,  fields: [:id]

due to here: https://github.com/rails-api/active_model_serializers/blob/master/lib/action_controller/serialization.rb#L50-L51

whereas this doesn't:

render(
  json: ActiveModel::SerializableResource.new(@videos.limit(1), {
    each_serializer: VideoSerializer,  fields: [:id]
  }).serializable_hash
)

@bf4
Copy link
Member

bf4 commented Jun 9, 2016

@bf4 bf4 closed this Jun 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants