Store the data drom "user_return_to" when a user register.

155 views
Skip to first unread message

Sylario Syl

unread,
May 8, 2013, 10:16:38 AM5/8/13
to plataforma...@googlegroups.com
My rails app (3 with devise 2.2 and pg as DB) use Devise for authentication. The whole app require for user to be logged-in.

When a new user request myapp.com/category/:c_id/product/:p_id/, devise redirect it to the register/log-in devise page.

Once the user is registered, he is redirected to the page he originally wanted to see (myapp.com/category/:c_id/product/:p_id/) with the session variable(created by devise) "user_return_to".

Everything i just described is already working fine. Now i will explain what i'd like to do.

When the user register, i'd like to store the information that he wanted to access this or that product. I'm not sure how i should do that exactly.

Where should i put the code that will intercept user_return_to and add it to the user data during a registration?

Lucas Mazza

unread,
May 26, 2013, 6:53:38 PM5/26/13
to plataforma...@googlegroups.com
Hey Sylario,

Take a look on Devise::FailureApp - is a Rack endpoint/Controller-ish class that deals with redirecting the user to the sign in page and you can extend it to store more data than just the return_to path. https://github.com/plataformatec/devise/blob/10c9a492ab27f48d66f50df7f1e7f5e8c68f2b0f/lib/devise/failure_app.rb#L54-L55



--
 
---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages