11
處理POST請求時,params [:id]返回已發佈表單中存儲的「id」的值。如何在Rails中獲取URL參數?
但是我想獲取存儲在url(查詢字符串)中的值。
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
那麼如何從POST請求中的URL中獲取值?