patch

patch(*args, &block) Instance Public methods Define a route that only recognizes HTTP PATCH. For supported arguments, see match patch 'bacon', to: 'food#bacon'

get

get(*args, &block) Instance Public methods Define a route that only recognizes HTTP GET. For supported arguments, see match get 'bacon', to: 'food#bacon'

delete

delete(*args, &block) Instance Public methods Define a route that only recognizes HTTP DELETE. For supported arguments, see match delete 'broccoli', to: 'food#broccoli'

concerns

concerns(*args) Instance Public methods Use the named concerns resources :posts do concerns :commentable end concerns also work in any routes helper that you want to use: namespace :posts do concerns :commentable end

concern

concern(name, callable = nil, &block) Instance Public methods Define a routing concern using a name. Concerns may be defined inline, using a block, or handled by another object, by passing that object as the second parameter. The concern object, if supplied, should respond to call, which will receive two parameters: * The current mapper * A hash of options which the concern object may use Options may also be used by concerns defined in a block by accepting a block parameter. So

with_default_scope

with_default_scope(scope, &block) Instance Public methods

root

root(options = {}) Instance Public methods You can specify what Rails should route â/â to with the root method: root to: 'pages#main' For options, see match, as root uses it internally. You can also pass a string which will expand root 'pages#main' You should put the root route at the top of config/routes.rb, because this means it will be matched first. As this is the most popular route of most Rails applications, this is beneficial.

mount

mount(app, options = nil) Instance Public methods Mount a Rack-based application to be used within the application. mount SomeRackApp, at: "some_route" Alternatively: mount(SomeRackApp => "some_route") For options, see match, as mount uses it internally. All mounted applications come with routing helpers to access them. These are named after the class specified, so for the above example the helper is either some_rack_app_path or some_rack_app_url. To customize this helper's na

match

match(path, options=nil) Instance Public methods Matches a url pattern to one or more routes. You should not use the `match` method in your router without specifying an HTTP method. If you want to expose your action to both GET and POST, use: # sets :controller, :action and :id in params match ':controller/:action/:id', via: [:get, :post] Note that :controller, :action, :id are interpreted as url query parameters and thus available as params in an action. If you want to expose y

has_named_route?

has_named_route?(name) Instance Public methods Query if the following named route was already defined.