views:

20

answers:

1

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!

A: 

I would consider an AJAX solution here. Present the login option on the same page without redirecting.

buckbova
Thanks, that would be another possibility. But as far as what I have seen it would require a lot of work to our auth system which would be too much hassle since its only a very optional component for course work. We now just redirect to the rating page and inform the user beforehand.
redfalcon