Created
May 12, 2015 20:06
-
-
Save noahmatisoff/65fbd193e8df52bf6e4a to your computer and use it in GitHub Desktop.
Pass parameters/options from a controller to an AMS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/controllers/users_controller.rb | |
| def show | |
| @user = User. | |
| render json: @user, winner: false, active: true | |
| end | |
| # app/serializers/user_serializer.rb | |
| attributes :winner, :active | |
| def winner | |
| options[:winner] | |
| end | |
| def active | |
| options[:active] | |
| end | |
| # output | |
| { | |
| winner: false, | |
| active: true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment