我希望在客户取消订阅后将其重定向到调查,但是在重定向到调查时会很难将会话销毁。
organizations_controller.rb:
def cancel
if @organization.subscription.cancel
redirect_to "http://example.com/contact/cancel?organization=#{@organization.resource_id}"
else
flash[:error] = "An error has occurred."
redirect_to settings_profile_path
end
end
我如何利用设计destroy_user_session_path
并同时重定向到suvery,而不会覆盖正常用户注销的重定向路径。当组织取消时,我只需要这个工作。
答案 0 :(得分:0)
我不太明白这个问题。您是否要销毁会话以便注销用户?如果是这样,请尝试以下操作:在应用程序控制器中添加此私有方法
def after_sign_out_path_for(user)
if blah
redirect_to :foo
else
redirect_to :bar
end
end
答案 1 :(得分:0)
用destroy_user_session_path
(一名设计助手)取代sign_out_all_scopes(lock=true)
就可以了。
def cancel
if @organization.subscription.cancel
sign_out_all_scopes(lock=true)
redirect_to "http://example.com/contact/cancel?organization=#{@organization.resource_id}"
else
flash[:error] = "An error has occurred."
redirect_to settings_profile_path
end
end