Class: Nitro::Controller
- Inherits:
-
Object
- Object
- Nitro::Controller
- Includes:
- Caching, Helpers, Publishable, Scaffolding
- Defined in:
- lib/nitro/controller.rb
Overview
The Controller part in the MVC paradigm. The controller’s published methods are called actrions. The controller class contains the Publishable mixin and additional helper mixins.
Direct Known Subclasses
Class Method Summary collapse
-
.current ⇒ Object
Returns the current controller from the context thread local variable.
-
.mounted(path) ⇒ Object
This callback is called after the Controller is mounted.
-
.replace_current(controller) ⇒ Object
– Replaces the current controller (helper for render).
Methods included from Helpers
Methods included from Caching
Methods included from Scaffolding
class_to_list, class_to_method, class_to_path, included
Methods included from Publishable
Class Method Details
.current ⇒ Object
Returns the current controller from the context thread local variable.
332 333 334 |
# File 'lib/nitro/controller.rb', line 332 def self.current Thread.current[:CURRENT_CONTROLLER] end |
.mounted(path) ⇒ Object
This callback is called after the Controller is mounted.
318 319 320 321 322 323 324 325 326 327 |
# File 'lib/nitro/controller.rb', line 318 def self.mounted path # Resolve aspects. Aspects.include_advice_modules(self) # The scaffolding code is compiled after the mount, so # that template roots are finalized. compile_scaffolding_code() end |
.replace_current(controller) ⇒ Object
– Replaces the current controller (helper for render). This is an internal method. ++
341 342 343 344 345 |
# File 'lib/nitro/controller.rb', line 341 def self.replace_current controller # :nodoc: old = Thread.current[:CURRENT_CONTROLLER] Thread.current[:CURRENT_CONTROLLER] = controller return old end |