我正在提取以下参数:
<%= link_to "Sign up", new_store_registration_path(:plan_id => plan.id, :price => plan.price) %>
注册后,我已设置重定向到 new_transaction_path
def after_sign_up_path_for(resource)
new_transaction_path(resource)
end
但是当重定向到新路径时,参数不会出现。如何在 new_transaction_path url 上显示两个参数?
最佳答案
我还没有测试过,但也许这有效:
在你的 Controller 中
def new
session[:registration_params] = request.query_parameters
end
在您的重定向方法中
def after_sign_up_path_for(resource)
new_transaction_path(resource, session[:registration_params])
end
关于ruby-on-rails - 保留url参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45008427/