Question

What does it mean when there are no HTTP verbs next to the URL pattern? For example, when I type

 rake routes

Here's a snippet of what I see:

PUT     /articles/:id
DELETE  /articles/:id
        /articles/:id/:article_page
        /articles/:id/:show_full

Notice lines 3 and 4 have no http verb. Do I assume it defaults to GET?

By the way, I'm working on a Rails 2.3.18 project.

Was it helpful?

Solution

It means that the route is accessible via all verbs.

This is not recommended and since Rails 4, you are encouraged to specify a verb.

Indeed, in Rails 4, you must explicitly mention via: :all:

match 'hello', to: 'dashboard#hello', via: :all
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top