ruby on rails - Showing error messages in a redirected request -
I am using Authlogic to do some simple signup and log-in stuff. In my WellController I have to create a signup and login form on the same page 'index', which is done with form actions set on its own separate controllers, user controller and user control controller, respectively. These controllers redirect the user to the protected profile page within the site on a successful signup / login error, I need to redirect back to the WelcomeController # Index and display their errors. Upon a redirect, this information is lost and I can not use a render because it is a different controller. What is the right way to handle this behavior?
Maybe I could store error messages in flash hash. It seems like the easiest solution.
Recently I have stumbled this problem in another application, in which I was writing, where I had to present summary pages from the researcher, submitted the RFP form to the Peer Review Controller. It looks like a case that now it will be used properly to use the disliked components. I.e.: render_component: controller => 'rfpform',: actions => 'summary', id => 213
The components look like dry ways to do something like this. Now when we do not have the right solution for them, then what?
A simple and easy way to pass a parameter on this redirect:
redirect_to welcome_url (: login_error = & gt; true)
In your view or controller, you can then test that for the absolute:
& Lt;% If the consultation [: error] -%> & Lt; Div class = "error" & gt; My error message & lt; / Div & gt; & Lt;% end -% & gt;
Comments
Post a Comment