i have a form, on submit i check if the user is logged in, if not, I redirect to the signin page, once they sign in I want to complete the form POST that they were attempting. Any ideas on how to do this?
So far I have attempted storing the request path in a cookie and redirecting back using this path but on redirect it treats it as a GET rather than a POST which is not correct.
def store_location
session[:return_to] = request.fullpath
end
def redirect_back_or(default)
redirect_to(session[:return_to] || default)
clear_return_to
end
One possible workaround is as follows,
Path 1 – user already logged in
submit form
save the details
Path 2 – User not logged in
submit form
check user logged in (false in this
case)
redirect to the signup page
have hidden fields in the signup page
to store the earlier form details
let user signup + add the previous
for details after you create the user
account
Note : these hidden fields (to store form1 data) should be optional as otherwise users should not be able to signup directly
HTH
sameera