Forum: Ruby on Rails ActionView::TemplateError (undefined method `url_for'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 cool_screen_name90001 (Guest)
on 2005-12-05 05:28
(Received via mailing list)
Wow, this is driving me crazy. I keep getting this error:

ActionView::TemplateError (undefined method `url_for' for
#<Notifier:0x40755260>) on line #0 of
app/views/notifier/link_added.rhtml:

Absolutely nowhere in that template (or the ActionMailer) is 'url_for',
nor any other methods. The
template just outputs variables. Notifier (an ActionMailer) just assigns
the vars. In my
controller I have:

def create
  ...
  Notifier::deliver_link_added(@site, @link,
url_for({:controller=>'link', :action=>'edit',
:id=>@link.id}))

  redirect_to({:controller => 'link', :action => 'added', :id =>
@link.id})
  ...
end

Furthering my insanity, I get one of three different results:
1. Application error with the aforementioned error in the log.
2. Link gets created, but Notifier's link_added template gets displayed
for link#added rather than
view/link/added.rhtml
3. Everything works fine!

Restarting SCGI usually lets #3 or #2 happen again, but adding
additional links thereafter usually
results in #1.

csn



__________________________________________
Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
This topic is locked and can not be replied to.