Class: NtqTools::ImpersonationController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/ntq_tools/impersonation_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/ntq_tools/impersonation_controller.rb', line 10

def index
  data = {}
  NtqTools.impersonation_user_models.each do |model|
    data[model.underscore] = model.constantize.all.map{|user| {
      id: user.id,
      label: label_for_user(user),
    }}
  end
  render json: { data: data }
end

#signinObject



21
22
23
24
25
26
27
# File 'app/controllers/ntq_tools/impersonation_controller.rb', line 21

def 
  @resource = params[:model_name].camelize.constantize.find params[:id]
  (@resource)
  return redirect_to @resource.after_impersonation_path if @resource.respond_to?(:after_impersonation_path)

  redirect_to (@resource)
end