Problem with url_for and named routes in ActionMailer View: "Need controller and action"

Posted by macek on Stack Overflow See other posts from Stack Overflow or by macek
Published on 2010-04-21T22:58:06Z Indexed on 2010/04/23 4:53 UTC
Read the original article Hit count: 355

I'm attempting to provide a confirmation link in my user welcome email and I'm getting the following Rails error:

Need controller and action!

It makes a fuss about this line:

<p>Please take a moment to activate your account by going to: 
<%= link_to confirm_user_url(:id => @user.confirmation_code) %>.</p>

In my development.rb environment, I have the following line:

config.action_mailer.default_url_options = {
  :host => "localhost", :port => 3000
}

There's no problem with the @user variable. I've tested the email with things like @user.username and @user.confirmation_code. I'm only getting trouble with url_for and named routes like confirm_user_url.

When I check my routes with rake routes, confirm_user shows up, so it's not an issue with the named route not existing.

I can't seem to figure it out. What gives?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about actionmailer