Pawan
2007-Jul-30 16:44 UTC
Question about form_tag : Error uninitialized constant Chapter2Controller::User
Hello, I am trying to pass the argument in form_tag but having some issue. This is what I have index.rhtml <%= form_tag :action => "process_login"%> User name: <%= text_field "user", "username" %><br> Password: <%= password_field "user", "password" %><br> <%= submit_tag ''Log In'' %> <%= end_form_tag %> Now, how do I see the username and password in controller. this is my process_login looks like controller.rb def login @user = User.new @user.username = params[:username] end def process_login redirect_to :action => ''login'', :username => params[:user][:username] end I get following error uninitialized constant Chapter2Controller::User Thank you --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
jemminger
2007-Jul-31 02:49 UTC
Re: Question about form_tag : Error uninitialized constant Chapter2Controller::User
have you created a User class? On Jul 30, 12:44 pm, Pawan <pgupt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > I am trying to pass the argument in form_tag but having some issue. > This is what I have > > index.rhtml > <%= form_tag :action => "process_login"%> > User name: <%= text_field "user", "username" %><br> > Password: <%= password_field "user", "password" %><br> > <%= submit_tag ''Log In'' %> > <%= end_form_tag %> > > Now, how do I see the username and password in controller. this is my > process_login looks like > > controller.rb > def login > @user = User.new > @user.username = params[:username] > end > def process_login > redirect_to :action => ''login'', :username => params[:user][:username] > end > > I get following error > uninitialized constant Chapter2Controller::User > > Thank you--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---