Module: Vedeu::Controller::SingletonMethods
- Defined in:
- lib/vedeu/application/controller.rb
Overview
Provide additional behaviour as singleton methods to the including class or module.
Instance Attribute Summary collapse
-
#controller_name ⇒ Object
writeonly
Sets the attribute controller_name.
Instance Method Summary collapse
-
#action(*action_names) ⇒ Array<Symbol>
(also: #action_name, #actions)
Specifying the action names in your controller provides Vedeu with the means to route requests to different parts of your application.
-
#controller(controller_name = nil) ⇒ Object
(also: #controller_name)
Specifying the controller name in your controller provides Vedeu with the means to route requests to different parts of your application.
Instance Attribute Details
#controller_name=(value) ⇒ Object (writeonly)
Sets the attribute controller_name
12 13 14 |
# File 'lib/vedeu/application/controller.rb', line 12 def controller_name=(value) @controller_name = value end |
Instance Method Details
#action(*action_names) ⇒ Array<Symbol> Also known as: action_name, actions
Specifying the action names in your controller provides Vedeu with the means to route requests to different parts of your application.
67 68 69 70 71 |
# File 'lib/vedeu/application/controller.rb', line 67 def action(*action_names) action_names.each do |action_name| Vedeu::Runtime::Router.add_action(@controller_name, action_name) end end |
#controller(controller_name = nil) ⇒ Object Also known as: controller_name
Specifying the controller name in your controller provides Vedeu with the means to route requests to different parts of your application.
32 33 34 35 36 37 |
# File 'lib/vedeu/application/controller.rb', line 32 def controller(controller_name = nil) @controller_name = controller_name Vedeu::Runtime::Router.add_controller(controller_name, ancestors[0].to_s) end |