method

resource

Importance_2
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActionDispatch::Routing::Mapper::Resources

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v4.0.2) is shown here.

These similar methods exist in v7.1.3.2:

resource(*resources, &block) public

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 :geocoder

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

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

Options

Takes same options as resources.

Show source
Register or log in to add new notes.