Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Combining Query Parameters and Request Bodies
class MembersController < ApplicationController
...
def index
@members = member_params.any? ? Member.where(member_params) : Member.all
json_options = params.fetch(:json_options, {})
render json: @members.as_json(HashWithIndifferentAccess.new(json_options.permit!))
end
def member_params
params.permit(:member_id, :employer_id, :plan_id)
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment