Class: RailsAdmin::ApplicationController

Inherits:
Object
  • Object
show all
Includes:
Extensions::ControllerExtension
Defined in:
app/controllers/rails_admin/application_controller.rb

Direct Known Subclasses

MainController

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#abstract_modelObject (readonly)

Returns the value of attribute abstract_model


24
25
26
# File 'app/controllers/rails_admin/application_controller.rb', line 24

def abstract_model
  @abstract_model
end

#authorization_adapterObject (readonly)

Returns the value of attribute authorization_adapter


24
25
26
# File 'app/controllers/rails_admin/application_controller.rb', line 24

def authorization_adapter
  @authorization_adapter
end

#model_configObject (readonly)

Returns the value of attribute model_config


24
25
26
# File 'app/controllers/rails_admin/application_controller.rb', line 24

def model_config
  @model_config
end

#objectObject (readonly)

Returns the value of attribute object


24
25
26
# File 'app/controllers/rails_admin/application_controller.rb', line 24

def object
  @object
end

Instance Method Details

#_current_userObject


41
42
43
# File 'app/controllers/rails_admin/application_controller.rb', line 41

def _current_user
  instance_eval(&RailsAdmin::Config.current_user_method)
end

#get_modelObject


26
27
28
29
30
31
# File 'app/controllers/rails_admin/application_controller.rb', line 26

def get_model
  @model_name = to_model_name(params[:model_name])
  raise(RailsAdmin::ModelNotFound) unless (@abstract_model = RailsAdmin::AbstractModel.new(@model_name))
  raise(RailsAdmin::ModelNotFound) if (@model_config = @abstract_model.config).excluded?
  @properties = @abstract_model.properties
end

#get_objectObject


33
34
35
# File 'app/controllers/rails_admin/application_controller.rb', line 33

def get_object
  raise(RailsAdmin::ObjectNotFound) unless (@object = @abstract_model.get(params[:id]))
end

#to_model_name(param) ⇒ Object


37
38
39
# File 'app/controllers/rails_admin/application_controller.rb', line 37

def to_model_name(param)
  param.split('~').collect(&:camelize).join('::')
end