resource

resource(*resources, &block)
Instance Public methods

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

creates six different routes in your application, all mapping to the Profiles controller (note that the controller is named after the plural):

GET       /profile/new
POST      /profile
GET       /profile
GET       /profile/edit
PATCH/PUT /profile
DELETE    /profile

Options

Takes same options as resources.

doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.