Hi. i made a simple controller thats_not_users then have a simple line in my layout rhtml file: <%= link_to "Users", :controller => "users", :action => "index" %> And I''m getting this error message within the layout template when loading the controller thats_not_users: NoMethodError in Controller undefined method `rewrite'' for #<String weird eh? -- 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 -~----------~----~----~----~------~----~------~--~---
Dominic Son wrote:> Hi. > > i made a simple controller thats_not_users > > then have a simple line in my layout rhtml file: > <%= link_to "Users", :controller => "users", :action => "index" > %> > > And I''m getting this error message within the layout template when > loading the controller thats_not_users: > > NoMethodError in Controller > undefined method `rewrite'' for #<String > > weird eh?Interesting -- I ran into the same problem. In my case, it''s ActionView::TemplateError (undefined method `rewrite'' for #<String:0xb7770f34>) on line #4 of app/views/game/_copyright.rhtml: /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:488:in `url_for'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:27:in `url_for'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:59:in `link_to'' #{RAILS_ROOT}/app/views/game/_copyright.rhtml:4:in `_run_rhtml_game__copyright'' [...more not-very-useful stack trace] The "offending" line was: <%= link_to "How this Works", :controller => ''members'', :action => ''howitworks''%> Anybody got any ideas? --Al Evans -- 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 -~----------~----~----~----~------~----~------~--~---
Al Evans wrote: [Stack trace from ''undefined method `rewrite'' for #<String...'']> > ActionView::TemplateError (undefined method `rewrite'' for > #<String:0xb7770f34>) on line #4 of app/views/game/_copyright.rhtml: > /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:488:in > `url_for'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:27:in > `url_for'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:59:in > `link_to'' > #{RAILS_ROOT}/app/views/game/_copyright.rhtml:4:in > `_run_rhtml_game__copyright'' > > [...more not-very-useful stack trace] > > The "offending" line was: > > <%= link_to "How this Works", :controller => ''members'', :action => > ''howitworks''%> > > Anybody got any ideas?I''ve run across this a couple of times today. It''s sporadic -- if I press the reload button on the browser, it doesn''t happen again. For what it''s worth, in both cases it seemed to happen the next time ''url_for'' was called after calling "deliver_<something>_email". "perform_deliveries" is set false. Maybe that will ring a bell with anyone? One of the URLs was in a controller, one in an rhtml file. Using literal urls, i.e. "/some_controller/some_action" solved the problem in both cases. Anybody else seen this? --Al Evans -- 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 -~----------~----~----~----~------~----~------~--~---
I just repro''ed it by assigning a string to the @url instance variable. Make sure your controller/helper/view code is NOT assigning to @url anywhere (either directly or indirectly). link_to/url_for and related uses the ActionController::Base @url instance variable to generate URLs, so if you (or plugins you''ve installed) clobber it somehow, you''ll get this error. Al Evans wrote:> Al Evans wrote: > > [Stack trace from ''undefined method `rewrite'' for #<String...''] > > > > ActionView::TemplateError (undefined method `rewrite'' for > > #<String:0xb7770f34>) on line #4 of app/views/game/_copyright.rhtml: > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:488:in > > `url_for'' > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:27:in > > `url_for'' > > /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:59:in > > `link_to'' > > #{RAILS_ROOT}/app/views/game/_copyright.rhtml:4:in > > `_run_rhtml_game__copyright'' > > > > [...more not-very-useful stack trace] > > > > The "offending" line was: > > > > <%= link_to "How this Works", :controller => ''members'', :action => > > ''howitworks''%> > > > > Anybody got any ideas? > > I''ve run across this a couple of times today. It''s sporadic -- if I > press the reload button on the browser, it doesn''t happen again. > > For what it''s worth, in both cases it seemed to happen the next time > ''url_for'' was called after calling "deliver_<something>_email". > "perform_deliveries" is set false. > > Maybe that will ring a bell with anyone? > > One of the URLs was in a controller, one in an rhtml file. > > Using literal urls, i.e. "/some_controller/some_action" solved the > problem in both cases. > > Anybody else seen this? > > --Al Evans > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Many Thanks Eden -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.