%base_name%.rb

Path: merb-slices/lib/generators/templates/full/lib/%base_name%.rb
Last Update: Tue Jul 28 08:32:52 +0200 2009

Methods

Public Class methods

Activation hook - runs after AfterAppLoads BootLoader

[Source]

    # File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 38
38:     def self.activate
39:     end

Deactivation hook - triggered by Merb::Slices.deactivate(<%= module_name %>)

[Source]

    # File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 42
42:     def self.deactivate
43:     end

Initialization hook - runs before AfterAppLoads BootLoader

[Source]

    # File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 34
34:     def self.init
35:     end

Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice‘s classes have been loaded internally.

[Source]

    # File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 30
30:     def self.loaded
31:     end

Setup routes inside the host application

@param scope<Merb::Router::Behaviour>

 Routes will be added within this scope (namespace). In fact, any
 router behaviour is a valid namespace, so you can attach
 routes at any level of your router setup.

@note prefix your named routes with :<%= symbol_name %>_

  to avoid potential conflicts with global named routes.

[Source]

    # File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 54
54:     def self.setup_router(scope)
55:       # example of a named route
56:       scope.match('/index(.:format)').to(:controller => 'main', :action => 'index').name(:index)
57:       # the slice is mounted at /<%= base_name %> - note that it comes before default_routes
58:       scope.match('/').to(:controller => 'main', :action => 'index').name(:home)
59:       # enable slice-level default routes by default
60:       scope.default_routes
61:     end

[Validate]