Module: ActsAsPolymorphicController::InstanceMethods
- Defined in:
- lib/acts_as_polymorphic_controller/controller.rb
Overview
ClassMethods
Instance Method Summary collapse
- #aapc_parent_class ⇒ Object
- #aapc_parent_controller ⇒ Object
- #aapc_parent_id(parent) ⇒ Object
- #aapc_parent_object ⇒ Object
- #aapc_parent_type ⇒ Object
Instance Method Details
#aapc_parent_class ⇒ Object
34 35 36 |
# File 'lib/acts_as_polymorphic_controller/controller.rb', line 34 def aapc_parent_class aapc_parent_type && aapc_parent_type.to_s.classify.constantize end |
#aapc_parent_controller ⇒ Object
42 43 44 |
# File 'lib/acts_as_polymorphic_controller/controller.rb', line 42 def aapc_parent_controller aapc_parent_type.to_s.pluralize end |
#aapc_parent_id(parent) ⇒ Object
26 27 28 |
# File 'lib/acts_as_polymorphic_controller/controller.rb', line 26 def aapc_parent_id(parent) params["#{parent}_id"] end |
#aapc_parent_object ⇒ Object
38 39 40 |
# File 'lib/acts_as_polymorphic_controller/controller.rb', line 38 def aapc_parent_object aapc_parent_class && aapc_parent_class.find_by_id(aapc_parent_id(aapc_parent_type)) end |
#aapc_parent_type ⇒ Object
30 31 32 |
# File 'lib/acts_as_polymorphic_controller/controller.rb', line 30 def aapc_parent_type @aapc_parent_objects.detect { |parent| aapc_parent_id(parent) } end |