Class: RademadeAdmin::Model::Reflection
- Inherits:
-
Object
- Object
- RademadeAdmin::Model::Reflection
- Defined in:
- lib/rademade_admin/model/reflection.rb,
lib/rademade_admin/model/reflection/data.rb,
lib/rademade_admin/model/reflection/uploader.rb
Defined Under Namespace
Constant Summary
Constants included from Data
Data::ORM_TYPE_ACTIVERECORD, Data::ORM_TYPE_MONGOID
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model, controller, controller_name, inner) ⇒ Reflection
constructor
A new instance of Reflection.
-
#model_related_name ⇒ Object
Admin::User => :users RademadeAdmin::User::Adapter => :adapters.
- #nested? ⇒ Boolean
- #parent_menu_item ⇒ Object
Methods included from Data
#association_fields, #data_adapter, #method_missing, #orm_type
Constructor Details
#initialize(model, controller, controller_name, inner) ⇒ Reflection
Returns a new instance of Reflection.
10 11 12 |
# File 'lib/rademade_admin/model/reflection.rb', line 10 def initialize(model, controller, controller_name, inner) @model, @controller, @controller_name, @inner = model, controller, controller_name, inner end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RademadeAdmin::Model::Reflection::Data
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
8 9 10 |
# File 'lib/rademade_admin/model/reflection.rb', line 8 def controller @controller end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'lib/rademade_admin/model/reflection.rb', line 8 def model @model end |
Instance Method Details
#model_related_name ⇒ Object
Admin::User => :users RademadeAdmin::User::Adapter => :adapters
25 26 27 |
# File 'lib/rademade_admin/model/reflection.rb', line 25 def @model.to_s.demodulize.pluralize.downcase.to_sym end |
#nested? ⇒ Boolean
18 19 20 |
# File 'lib/rademade_admin/model/reflection.rb', line 18 def nested? @inner end |
#parent_menu_item ⇒ Object
14 15 16 |
# File 'lib/rademade_admin/model/reflection.rb', line 14 def @controller_name.camelize.constantize.instance_variable_get('@parent_item') end |