Module: Vedeu::Controller::ClassMethods

Defined in:
lib/vedeu/application/controller.rb

Overview

When included, provide these methods as class methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controller_name=(value) ⇒ Object (writeonly)

Sets the attribute controller_name



13
14
15
# File 'lib/vedeu/application/controller.rb', line 13

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.

Examples:

class YourController

  controller :your_controller

  action :show
  # or...
  actions :show, :list
  # or...
  action_name :show

  # ... some code

end

Vedeu.trigger(:_goto_,
              :your_controller,
              :show,
              { some: :args })


68
69
70
71
72
# File 'lib/vedeu/application/controller.rb', line 68

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.

Examples:

class YourController

  controller :your_controller
  # or...
  controller_name :your_controller

  # ... some code

end


33
34
35
36
37
38
# File 'lib/vedeu/application/controller.rb', line 33

def controller(controller_name = nil)
  @controller_name = controller_name

  Vedeu::Runtime::Router.add_controller(controller_name,
                                        ancestors[0].to_s)
end