Class: ModelController

Inherits:
Object show all
Defined in:
lib/volt/controllers/model_controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(model = nil) ⇒ ModelController

Returns a new instance of ModelController.



2
3
4
# File 'lib/volt/controllers/model_controller.rb', line 2

def initialize(model=nil)
  @model = model
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



26
27
28
# File 'lib/volt/controllers/model_controller.rb', line 26

def method_missing(method_name, *args, &block)
  return @model.send(method_name, *args, &block)      
end

Instance Method Details

#controllerObject



22
23
24
# File 'lib/volt/controllers/model_controller.rb', line 22

def controller
  @controller ||= ReactiveValue.new(Model.new)
end

#pageObject



6
7
8
# File 'lib/volt/controllers/model_controller.rb', line 6

def page
  $page.page
end

#paramsObject



14
15
16
# File 'lib/volt/controllers/model_controller.rb', line 14

def params
  $page.params 
end

#storeObject



10
11
12
# File 'lib/volt/controllers/model_controller.rb', line 10

def store
  $page.store
end

#urlObject



18
19
20
# File 'lib/volt/controllers/model_controller.rb', line 18

def url
  $page.url 
end