module Resources
Ruby on Rails 7.0.10
Since v3.0.20Resource 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.
Constants
Methods (defined here)
Private methods
(29)
Implementation detail — not part of the public API.
- # action_options?
- # action_path
- # add_route
- # api_only?
- # apply_action_options
- # apply_common_behavior_for
- # canonical_action?
- # decomposed_match
- # get_to_from_path
- # map_match
- # match_root_route
- # name_for_action
- # nested_options
- # nested_scope?
- # param_constraint
- # param_constraint?
- # parent_resource
- # path_for_action
- # path_scope
- # prefix_name_for_action
- # resource_method_scope?
- # resource_scope
- # resource_scope?
- # scope_action_options
- # set_member_mappings_for_resource
- # shallow_nesting_depth
- # shallow_scope
- # using_match_shorthand?
- # with_scope_level