Skip to content

Instantly share code, notes, and snippets.

@noahmatisoff
Created May 12, 2015 20:06
Show Gist options
  • Save noahmatisoff/65fbd193e8df52bf6e4a to your computer and use it in GitHub Desktop.
Save noahmatisoff/65fbd193e8df52bf6e4a to your computer and use it in GitHub Desktop.
Pass parameters/options from a controller to an AMS.
# 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