Class: AdminResources::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/admin_resources/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#admin_modelsObject



16
17
18
# File 'app/controllers/admin_resources/application_controller.rb', line 16

def admin_models
  AdminResources.model_names
end

#admin_path_for(model_name, action = :index, resource = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/admin_resources/application_controller.rb', line 20

def admin_path_for(model_name, action = :index, resource = nil)
  route_name = model_name.underscore.pluralize
  case action
  when :index
    send("admin_resources_#{route_name}_path")
  when :new
    send("new_admin_resources_#{route_name.singularize}_path")
  when :show
    send("admin_resources_#{route_name.singularize}_path", resource)
  when :edit
    send("edit_admin_resources_#{route_name.singularize}_path", resource)
  end
end

#after_sign_in_path_for(resource) ⇒ Object



6
7
8
# File 'app/controllers/admin_resources/application_controller.rb', line 6

def (resource)
  admin_resources.root_path
end

#after_sign_out_path_for(resource_or_scope) ⇒ Object



10
11
12
# File 'app/controllers/admin_resources/application_controller.rb', line 10

def after_sign_out_path_for(resource_or_scope)
  admin_resources.new_admin_user_session_path
end