Skip to content
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

Add doc for setting conditional serialization_scope #1824

Merged

Conversation

yogeshjain999
Copy link
Contributor

Purpose

I want to set serialization_scope as different object rather than current_user, for only specific actions in given controller.

Changes

Adding documentation for how to conditionally set serialization_scope in controllers.

Related GitHub issues

#1711

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @bf4, @groyoh and @cgmckeever to be potential reviewers

User.new(id: 2, name: 'Bob', admin: false)
end
end
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the documentation could be better served by showing how to change scopes for a single serializer versus a different scope for two serializers. I get the concept is the same, but it is not as straight forward IMO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow -- that is some deep HOWTO ;)

I read it a couple times, and loosely am going to answer you question with a 'yes' ....

@bf4
Copy link
Member

bf4 commented Jun 30, 2016

@yogeshjain999 look good to me. Is this basically the code you're using?

@yogeshjain999
Copy link
Contributor Author

yes, @bf4. I'm using the same approach.

@bf4 bf4 merged commit 61059e9 into rails-api:master Jul 5, 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