Frage

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.

War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top