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/.
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
[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?
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.