Class | Ramaze::Controller
In: | lib/ramaze/controller.rb
Parent: | Object

Ramaze::Controller is the base controller of all controllers when developing applications in Ramaze. It acts as a nice wrapper around Innate::Node and allows for a more traditional MVC approach.

@example An example controller

     class Posts < Ramaze::Controller
       map '/posts'

       def index

       end
     end

@author Michael Fellinger @since 04-01-2009

### Methods

app engine generate_mapping inherited map mapping options setup setup_procedure

### Included Modules

Innate::Traited Innate::Node

### Constants

CONTROLLER_LIST | = | Set.new
IRREGULAR_MAPPING | = | { 'Controller' => nil, 'MainController' => '/' |  | Hash containing the names of two common controller names and the URIs they should be mapped to. @author Michael Fellinger @since 04-01-2009

### Public Class methods

app()

Returns the application to which the controller belongs to.

@author Michael Fellinger @since 04-01-2009 @return [Ramaze::App]

engine(name)

Sets the view engine to use for pages with a content type of text/html.

@example

     class Posts < Ramaze::Controller
       engine :etanni
     end

@author Michael Fellinger @since 04-01-2009 @param [to_sym] name The name of the view engine to use.

generate_mapping(klass_name = self.name)

Generates a URI for the full namespace of a class. If a class is named A::B::C the URI would be /a/b/c.

@author Michael Fellinger @since 04-01-2009 @param [String] klass_name The name of the class for which to generate

     the mapping, defaults to the current class.

@return [String]

inherited(into)

Modifies the extending class so that it‘s properly set up to be used as a controller.

@author Michael Fellinger @since 04-01-2009 @param [Class] into The class that extended Ramaze::Controller (or a sub

     class).

map(location, app_name = nil)

Maps the current class to the specified location.

@author Michael Fellinger @since 04-01-2009 @param [String] location The URI to map the controller to. @param [String] app_name The name of the application the controller

     belongs to.

mapping()

Returns the URI a controller is mapped to.

@author Michael Fellinger @since 04-01-2009 @return [String]

options()

Returns all the options for the application the controller belongs to.

@author Michael Fellinger @since 04-01-2009 @return [Innate::Options]

setup()

Sets all the controllers up and loads a default controller in case no custom ones have been specified.

@author Michael Fellinger @since 04-01-2009

setup_procedure()

Method that‘s used to setup each controller, called by Ramaze::Controller.setup.

@author Michael Fellinger @since 04-01-2009

[Validate]