Whenever I try to pass an options hash to the link_to method (or url_for, or button_to) I get this error: undefined method `rewrite' for :ActionController::Routing::PathSegment::Result The trace ends with /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/base.rb:522:in `url_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/helpers/url_helper.rb:27:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/helpers/url_helper.rb:27:in `url_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_view/helpers/url_helper.rb:75:in `link_to' url.rewrite is defined in a module named "url_rewriter.rb", so I know it;s there. Why is this happening?
on 2007-04-07 08:06
on 2007-04-07 19:24
Figured it out. I had a route with a parameter named 'url'. Apparently, that was confusing Rails; I assume 'url' is reserved (or at least reserved from a practical point of view). Funny, but testing in console worked fine. This seems like a problem - if it fails in the real world, it should fail in console (else what's the point of checking your routing in console?). Something similar happened once when I named a model "file".