I am trying to implement a basic login page: login.rhtml 1 <fieldset> 2 <% form_tag do %> 3 <label for="name">Name:</label> 4 <%= text_field_tag :name, params[:name] %> 5 <label for="password">Password:</label> 6 <%= password_field_tag :password, params[:password] %> 7 <%= submit_tag "Login" %> 8 <% end %> 9 </fieldset> However, I''m getting the following error on line 4: undefined method `tr'' for :name:Symbol Am I using text_field_tag incorrectly? Here is my controller: LoginController < Application Controller 1 def login 2 session[:user_id] = nil 3 if request.post? 4 user = User.authenticate(params[:name], params[:password]) 5 if user 6 session[:user_id] = user.id 7 redirect_to(:action => "index") 8 else 9 flash.now[:notice] = "Invalid user/password combination" 10 end 11 end 12 end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
No, everything looks fine. I copy / pasted your view code into a test view and it rendered find. Can you paste the full error output? Peter Marks wrote:> I am trying to implement a basic login page: > > login.rhtml > > 1 <fieldset> > 2 <% form_tag do %> > 3 <label for="name">Name:</label> > 4 <%= text_field_tag :name, params[:name] %> > 5 <label for="password">Password:</label> > 6 <%= password_field_tag :password, params[:password] %> > 7 <%= submit_tag "Login" %> > 8 <% end %> > 9 </fieldset> > > However, I''m getting the following error on line 4: > > undefined method `tr'' for :name:Symbol > > Am I using text_field_tag incorrectly? Here is my controller: > > LoginController < Application Controller > > 1 def login > 2 session[:user_id] = nil > 3 if request.post? > 4 user = User.authenticate(params[:name], params[:password]) > 5 if user > 6 session[:user_id] = user.id > 7 redirect_to(:action => "index") > 8 else > 9 flash.now[:notice] = "Invalid user/password combination" > 10 end > 11 end > 12 end >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
William Pratt wrote:> No, everything looks fine. I copy / pasted your view code into a test > view and it rendered find. Can you paste the full error output?Thanks for your interest William. The complete versions of the pages are here: login_controller.rb http://pastie.caboo.se/103948 login.rhtml http://pastie.caboo.se/103949 Here is my full error output: NoMethodError in Login#login Showing app/views/login/login.rhtml where line #8 raised: undefined method `tr'' for :name:Symbol Extracted source (around line #8): 5: <% form_tag do %> 6: <p> 7: <label for="name">Name:</label> 8: <%= text_field_tag :name, params[:name] %> 9: </p> 10: 11: <p> RAILS_ROOT: /Users/petermarks/Documents/Rails/Orbus/config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:99:in `split_dom_id'' #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:109:in `controller_method'' #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:128:in `viewer_method_eventattr'' #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:70:in `observer'' #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:24:in `tag'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/form_tag_helper.rb:94:in `text_field_tag'' #{RAILS_ROOT}/app/views/login/login.rhtml:8:in `_run_rhtml_47app47views47login47login46rhtml'' #{RAILS_ROOT}/app/views/login/login.rhtml:5:in `_run_rhtml_47app47views47login47login46rhtml'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/mongrel_rails:16:in `load'' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/mongrel_rails:16 Request Parameters: None Show session dump Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Definitely odd, but based on the stack trace, the issue is with a plugin you have installed, krjs. I am not familiar with it, but according to the website: Introducing the KRJS plugin <http://choonkeat.svnrepository.com/svn/rails-plugins/krjs/>, with less than 60 lines of patch to Rails'' ActionPack itself (*which probably means bugs are aplenty,* would slow production sites to a crawl, and that its fresh from the oven too) I would try removing this plugin or make sure you are running the latest version. Looks like the official site is here: http://choonkeat.svnrepository.com/rails-plugins/trac.cgi/wiki Hope this helps. Peter Marks wrote:> William Pratt wrote: > >> No, everything looks fine. I copy / pasted your view code into a test >> view and it rendered find. Can you paste the full error output? >> > > Thanks for your interest William. The complete versions of the pages are > here: > > login_controller.rb > http://pastie.caboo.se/103948 > > login.rhtml > http://pastie.caboo.se/103949 > > Here is my full error output: > > NoMethodError in Login#login > > Showing app/views/login/login.rhtml where line #8 raised: > > undefined method `tr'' for :name:Symbol > Extracted source (around line #8): > > 5: <% form_tag do %> > 6: <p> > 7: <label for="name">Name:</label> > 8: <%= text_field_tag :name, params[:name] %> > 9: </p> > 10: > 11: <p> > RAILS_ROOT: /Users/petermarks/Documents/Rails/Orbus/config/.. > > Application Trace | Framework Trace | Full Trace > #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:99:in `split_dom_id'' > #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:109:in `controller_method'' > #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:128:in > `viewer_method_eventattr'' > #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:70:in `observer'' > #{RAILS_ROOT}/vendor/plugins/krjs/lib/krjs.rb:24:in `tag'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/form_tag_helper.rb:94:in > `text_field_tag'' > #{RAILS_ROOT}/app/views/login/login.rhtml:8:in > `_run_rhtml_47app47views47login47login46rhtml'' > #{RAILS_ROOT}/app/views/login/login.rhtml:5:in > `_run_rhtml_47app47views47login47login46rhtml'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/mongrel_rails:16:in > `load'' > /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/mongrel_rails:16 > Request > > Parameters: None > > Show session dump > > Response > > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you very much for taking a look at this. I''ll uninstall kjrs and see what happens. Thanks again, Peter -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
np, let me know what happens. Peter Marks wrote:> Thank you very much for taking a look at this. I''ll uninstall kjrs and > see what happens. > > Thanks again, > > Peter >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Peter Why don;t you take a look at acts_as_authenticated for guidance ? On Oct 5, 8:29 am, Peter Marks <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am trying to implement a basic login page: > > login.rhtml > > 1 <fieldset> > 2 <% form_tag do %> > 3 <label for="name">Name:</label> > 4 <%= text_field_tag :name, params[:name] %> > 5 <label for="password">Password:</label> > 6 <%= password_field_tag :password, params[:password] %> > 7 <%= submit_tag "Login" %> > 8 <% end %> > 9 </fieldset> > > However, I''m getting the following error on line 4: > > undefined method `tr'' for :name:Symbol > > Am I using text_field_tag incorrectly? Here is my controller: > > LoginController < Application Controller > > 1 def login > 2 session[:user_id] = nil > 3 if request.post? > 4 user = User.authenticate(params[:name], params[:password]) > 5 if user > 6 session[:user_id] = user.id > 7 redirect_to(:action => "index") > 8 else > 9 flash.now[:notice] = "Invalid user/password combination" > 10 end > 11 end > 12 end > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Uninstalling the kjrs plugin fixed this right up. Thanks again William. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- Link_to popup divorced from controller?
- attachment_fu seems to be searching the wrong location for my images
- collection.build or collection.create gives "ArgumentError: wrong number of arguments (1 for 0)"
- Model still using mysql
- Ferret locks up when adding items to an index