Class: RailsAdmin::ApplicationController
- Inherits:
-
Object
- Object
- RailsAdmin::ApplicationController
- Includes:
- Extensions::ControllerExtension
- Defined in:
- app/controllers/rails_admin/application_controller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#abstract_model ⇒ Object
readonly
Returns the value of attribute abstract_model.
-
#authorization_adapter ⇒ Object
readonly
Returns the value of attribute authorization_adapter.
-
#model_config ⇒ Object
readonly
Returns the value of attribute model_config.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
Instance Attribute Details
#abstract_model ⇒ Object (readonly)
Returns the value of attribute abstract_model.
26 27 28 |
# File 'app/controllers/rails_admin/application_controller.rb', line 26 def abstract_model @abstract_model end |
#authorization_adapter ⇒ Object (readonly)
Returns the value of attribute authorization_adapter.
26 27 28 |
# File 'app/controllers/rails_admin/application_controller.rb', line 26 def @authorization_adapter end |
#model_config ⇒ Object (readonly)
Returns the value of attribute model_config.
26 27 28 |
# File 'app/controllers/rails_admin/application_controller.rb', line 26 def model_config @model_config end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
26 27 28 |
# File 'app/controllers/rails_admin/application_controller.rb', line 26 def object @object end |
Instance Method Details
#_current_user ⇒ Object
44 45 46 |
# File 'app/controllers/rails_admin/application_controller.rb', line 44 def _current_user instance_eval(&RailsAdmin::Config.current_user_method) end |
#get_model ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/controllers/rails_admin/application_controller.rb', line 28 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_object ⇒ Object
36 37 38 |
# File 'app/controllers/rails_admin/application_controller.rb', line 36 def get_object raise RailsAdmin::ObjectNotFound unless (@object = @abstract_model.get(params[:id], @model_config.scope)) end |
#to_model_name(param) ⇒ Object
40 41 42 |
# File 'app/controllers/rails_admin/application_controller.rb', line 40 def to_model_name(param) param.split('~').collect(&:camelize).join('::') end |