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?
on 2006-09-27 20:42
on 2006-10-05 15:14
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
on 2006-10-05 23:21
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
on 2006-10-06 06:50
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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.