Adding Links

Premium Content - Free Preview

Devise Paths

Navigate to /rails/info/routes to see the new paths that Devise created. Here are the paths Devise created for signing up, signing in and signing out:

Path Helper HTTP Verb Path Controller#Action
new_user_session_path GET /users/sign_in(.:format) devise/sessions#new
user_session_path POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session_path DELETE /users/sign_out(.:format) devise/sessions#destroy
user_registration_path POST /users(.:format) devise/registrations#create
new_user_registration_path GET /users/sign_up(.:format) devise/registrations#new

HTTP Verbs

Every web request (such as going to products/3) has an HTTP verb (or "method") associated with it, which explains the action the user wants to perform. The most common verb is GET, to get a web page or file without changing anything. As you can see above, there are other HTTP verbs; here's what each request is for:

  • POST - create a resource, such as a new user or product
  • GET - display a resource on a site, such as a product information
  • PUT - update a resource (we don't need that yet)
  • DELETE - delete a resource, such as a user or product

As mentioned in Standard Resources, Rails provides a standard way to map URLs to actions. These 4 HTTP actions correspond to the 4 standard CRUD operations - Create, Read, Update, Delete. Rails helps you create standardized routes where each requests uses the appropriate verb. When your routes follow this standardized format, they are called RESTful resources.

End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Contact Us
Sign in or email us at [email protected]