11
Quando viene elaborata una richiesta POST, params [: id] restituisce il valore di "id" memorizzato nel modulo che è stato pubblicato.Come ottenere i parametri URL in Rails?
Tuttavia, desidero ottenere il valore memorizzato nell'URL (stringa di query).
def some_action
id = params[:id] # Gets id from here: /some_action?id=[VALUE] only when request.post? is false
if request.post?
# Do some stuff, can't get the id value from the url
...
end
Così come ottenere il valore dal URL in una richiesta POST?