HTTP Verb | Path | Controller#Action | Used for |
---|---|---|---|
GET |
/photos |
photos#index |
display a list of all photos |
PUT |
/photos/:id/valid OR /photos/valid |
photos#validate |
tell whether the passed data are valid (204 or 422) |
HEAD |
/photos/:id OR /photos?people=Sam |
photos#exist |
tell whether that photo exists (204 or 404) |
GET |
/photos/new |
photos#new |
return an HTML form for creating a new photo |
POST |
/photos |
photos#create |
create a new photo |
GET |
/photos/:id |
photos#show |
display a specific photo |
GET |
/photos/:id/edit |
photos#edit |
return an HTML form for editing a photo |
PATCH /PUT |
/photos/:id |
photos#update |
update a specific photo |
DELETE |
/photos/:id |
photos#destroy |
delete a specific photo |
see: https://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
As HTML
<form>
's method can only beGET
/POST
,method-override
can be handy :