Class Merb::Rack::Console
In: lib/merb-core/rack/adapter/irb.rb
Parent: Object

Methods

Public Instance methods

Ends a sandboxed session (delegates to any Merb::Orms::* modules).

An ORM should implement Merb::Orms::MyOrm#close_sandbox! to support this. Usually this involves rolling back a transaction. :api: public

Starts a sandboxed session (delegates to any Merb::Orms::* modules).

An ORM should implement Merb::Orms::MyOrm#open_sandbox! to support this. Usually this involves starting a transaction. :api: public

Reloads classes using Merb::BootLoader::ReloadClasses. :api: public

Generates a URL for a single or nested resource.

Parameters

resources<Symbol,Object>:The resources for which the URL
  should be generated. These resources should be specified
  in the router.rb file using #resources and #resource.
options<Hash>:Any extra parameters that are needed to
  generate the URL.

Returns

String:The generated URL.

Examples

Merb::Router.prepare do

  resources :users do
    resources :comments
  end

end

resource(:users) # => /users resource(@user) # => /users/10 resource(@user, :comments) # => /users/10/comments resource(@user, @comment) # => /users/10/comments/15 resource(:users, :new) # => /users/new resource(:@user, :edit) # => /users/10/edit

:api: public

Returns a request for a specific URL and method. :api: public

Prints all routes for the application. :api: public

Explictly show logger output during IRB session :api: public

There are three possible ways to use this method. First, if you have a named route, you can specify the route as the first parameter as a symbol and any paramters in a hash. Second, you can generate the default route by just passing the params hash, just passing the params hash. Finally, you can use the anonymous parameters. This allows you to specify the parameters to a named route in the order they appear in the router.

Parameters(Named Route)

name<Symbol>:The name of the route.
args<Hash>:Parameters for the route generation.

Parameters(Default Route)

args<Hash>:Parameters for the route generation. This route will use the default route.

Parameters(Anonymous Parameters)

name<Symbol>:The name of the route.
args<Array>:An array of anonymous parameters to generate the route with. These parameters are assigned to the route parameters in the order that they are passed.

Returns

String:The generated URL.

Examples

Named Route

Merb::Router.prepare do

  match("/articles/:title").to(:controller => :articles, :action => :show).name("articles")

end

url(:articles, :title => "new_article")

Default Route

Merb::Router.prepare do

  default_routes

end

url(:controller => "articles", :action => "new")

Anonymous Paramters

Merb::Router.prepare do

  match("/articles/:year/:month/:title").to(:controller => :articles, :action => :show).name("articles")

end

url(:articles, 2008, 10, "test_article")

:api: public

[Validate]