Type:
Module
Constants:
VALID_ON_OPTIONS : [:new, :collection, :member]

CANONICAL_ACTIONS holds all actions that does not need a prefix or a path appended since they fit properly in their scope level.

RESOURCE_OPTIONS : [:as, :controller, :path, :only, :except, :param, :concerns]
CANONICAL_ACTIONS : %w(index create new show update destroy)
RESOURCE_METHOD_SCOPES : [:collection, :member, :new]
RESOURCE_SCOPES : [:resource, :resources]

Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index, show, new, edit, create, update and destroy actions, a resourceful route declares them in a single line of code:

resources :photos

Sometimes, you have a resource that clients always look up without referencing an ID. A common example, /profile always shows the profile of the currently logged in user. In this case, you can use a singular resource to map /profile (rather than /profile/:id) to the show action.

resource :profile

It's common to have resources that are logically children of other resources:

resources :magazines do
  resources :ads
end

You may wish to organize groups of controllers under a namespace. Most commonly, you might group a number of administrative controllers under an admin namespace. You would place these controllers under the app/controllers/admin directory, and you can group them together in your router:

namespace "admin" do
  resources :posts, :comments
end

By default the :id parameter doesn't accept dots. If you need to use dots as part of the :id parameter add a constraint which overrides this restriction, e.g:

resources :articles, id: /[^\/]+/

This allows any character other than a slash as part of your :id.

namespace

namespace(path, options = {}) Instance Public methods See

2015-06-20 00:00:00
root

root(path, options={}) Instance Public methods

2015-06-20 00:00:00
resources

resources(*resources, &block) Instance Public methods In Rails, a resourceful

2015-06-20 00:00:00
resource

resource(*resources, &block) Instance Public methods Sometimes, you have

2015-06-20 00:00:00
resources_path_names

resources_path_names(options) Instance Public methods

2015-06-20 00:00:00
shallow

shallow() Instance Public methods

2015-06-20 00:00:00
with_exclusive_scope

with_exclusive_scope() Instance Protected methods

2015-06-20 00:00:00
collection

collection() Instance Public methods To add a route to the collection:

2015-06-20 00:00:00
shallow?

shallow?() Instance Public methods

2015-06-20 00:00:00
with_scope_level

with_scope_level(kind) Instance Protected methods

2015-06-20 00:00:00