Skip to content

Instantly share code, notes, and snippets.

@Hasstrup
Last active November 5, 2024 21:12
Show Gist options
  • Save Hasstrup/bef7e8e359e36dc2842d0b38d5acb953 to your computer and use it in GitHub Desktop.
Save Hasstrup/bef7e8e359e36dc2842d0b38d5acb953 to your computer and use it in GitHub Desktop.
class UsersController < ApplicationController
def show
context = ::Users::Contexts::Fetch.call(params: query_users_params, type: :single)
return error_response(context.message) unless context.success?
render json: UserBlueprint.render(context.payload), status: :ok
end
private
def query_users_params
@query_users_params ||= Users::QueryInput.new(fields: params.permit!.to_h)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment