metamaps--metamaps/app/controllers/api/v2/users_controller.rb
Devin Howard e544d6a6db refactor api and fix bugs (#1088)
* fix weird double-embed issue

* fix users/current api if not logged in

* turbocharge the api

* fix docs
2017-03-09 14:24:52 -05:00

25 lines
577 B
Ruby

# frozen_string_literal: true
module Api
module V2
class UsersController < RestfulController
def current
raise Pundit::NotAuthorizedError if current_user.nil?
@user = current_user
authorize @user
show # delegate to the normal show function
end
private
def searchable_columns
[:name]
end
# only ask serializer to return is_admin field if we're on the
# current_user action
def default_scope
super.merge(show_full_user: action_name == 'current')
end
end
end
end