Class: RailsAdmin::ApplicationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsAdmin::ApplicationController
show all
- Defined in:
- app/controllers/rails_admin/application_controller.rb
Instance Method Summary
collapse
Instance Method Details
#get_model ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'app/controllers/rails_admin/application_controller.rb', line 12
def get_model
model_name = to_model_name(params[:model_name])
@abstract_model = RailsAdmin::AbstractModel.new(model_name)
not_found unless @abstract_model
@model_config = RailsAdmin.config(@abstract_model)
not_found if @model_config.excluded?
@properties = @abstract_model.properties
end
|
#get_object ⇒ Object
27
28
29
30
|
# File 'app/controllers/rails_admin/application_controller.rb', line 27
def get_object
@object = @abstract_model.get(params[:id])
not_found unless @object
end
|
#to_model_name(param) ⇒ Object
21
22
23
24
25
|
# File 'app/controllers/rails_admin/application_controller.rb', line 21
def to_model_name(param)
parts = param.split("~")
parts[-1] = parts.last.singularize
parts.map(&:camelize).join("::")
end
|