I’ve noticed that when you rails generate scaffold Thing
, the actions create
and update
of ThingsController
use the default 302 redirection status code while destroy
explicitly uses 303.
Is there a particular reason to not use 303 for create
and update
?
Also, why is 302 used as default for redirect_to
in the first place? 303 is explicit in that it requires a GET request and most clients treat a 302 as a 303 anyway, so why use the old, poorly implemented one (according to spec)? If the reason is backwards compatibility, then why is 303 used for destroy
?
I view the auto-generated code as a “best practice starting point”, so I’m interested what the rationale for each of these decisions is.