Is mapping a 'GET' request to 'controller#destroy' in Rails routes.rb dangerous/bad practice? -


i'm wondering convention regarding use of requests mapped 'destroy' actions in rails. checking out railscast on authentication , ryan chose map request sessions#destroy action link using simple anchor tag, rather form_for/button_to helper generate button contains _method: delete attribute:

auth::application.routes.draw     "log_in" => "sessions#new", :as => "log_in"     "log_out" => "sessions#destroy", :as => "log_out"      "sign_up" => "users#new", :as => "sign_up"     root :to => "users#new"     resources :users     resources :sessions   end   

i under impression not how supposed done, ryan bates 1 of creators of rails i'm wondering if big of deal i've been made believe.

are there serious downsides kind of routing implementation or stylistic convention meant promote clarity?

you're violating spec http/1.1 if use destroy actions:

in particular, convention has been established , head methods should not have significance of taking action other retrieval. these methods ought considered "safe". allows user agents represent other methods, such post, put , delete, in special way, user made aware of fact possibly unsafe action being requested. (9.1.1)


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -