I have a login section that is part of my view from my sign_up controller. Validating my user happens through a login_controller. Now if validation is good it is ok because I have a redirect in my login_controller. But if the login is not successful I have to go back to my view from my sign_up controller. Using redirect makes no sense because my @user_login object is lost and so are errors. How would you suggest I go about this? Thanks.
John Kopanas wrote:> I have a login section that is part of my view from my sign_up > controller. Validating my user happens through a login_controller. > Now if validation is good it is ok because I have a redirect in my > login_controller. But if the login is not successful I have to go > back to my view from my sign_up controller. Using redirect makes no > sense because my @user_login object is lost and so are errors. > > How would you suggest I go about this?Use flash[..] array (function) to store data from one controller to another. - Adam
so you suggest I pass it like this for example: flash[:user] = @user_login And then access the object from flash[:user]? On 1-Jun-05, at 5:40 PM, Adam Majer wrote:> John Kopanas wrote: > > >> I have a login section that is part of my view from my sign_up >> controller. Validating my user happens through a >> login_controller. Now if validation is good it is ok because I >> have a redirect in my login_controller. But if the login is not >> successful I have to go back to my view from my sign_up >> controller. Using redirect makes no sense because my @user_login >> object is lost and so are errors. >> >> How would you suggest I go about this? >> > > > Use flash[..] array (function) to store data from one controller to > another. > > - Adam > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >
John Kopanas wrote:> so you suggest I pass it like this for example: > > flash[:user] = @user_login > > And then access the object from flash[:user]? >Wouldn''t this be flash[:user] = user_login in the controller? You should not use the view to manipulate anything. For more information on MVC, you should read something like, java.sun.com/blueprints/patterns/MVC.html indiawebdevelopers.com/technology/java/mvcarchitecture.asp These are java specific, but what is important here is to get the feel of what each component should do. - Adam