Saving form values to database after a user logs in
Posted
by redfalcon
on Stack Overflow
See other posts from Stack Overflow
or by redfalcon
Published on 2010-06-16T14:59:01Z
Indexed on
2010/06/16
15:02 UTC
Read the original article
Hit count: 206
ruby-on-rails
|restful-authentication
Hi.
We have a form with ratings to submit for a certain restaurant. After the user has entered some values and wants to submit them, we check whether the user is logged in or not. If not, we display a login form and let the user put in his account data and redirect him to the restaurant he wanted to submit a rating for. The problem is, that after he successfully logged in himself, the submitted values are not saved to the database (which works fine if the user is already logged in). So I wondered if it is possible, to somehow save the data although the user is not logged in. I thought of maybe saving the filled values in a variable and have then automatically re-entered after we redirected the user. But I guess this wont work because we use
before_filter :login_required, :only => [ :create ]
So we couldnt even access the filled in values, since we display the login-form before the method has processed the values in the form, right?
Any idea how we can make rails to save the values or at least have them automatically re-entered to the form?
Thanks!
© Stack Overflow or respective owner