This project is archived and is in readonly mode.

#1858 ✓invalid
Russell Quinn

ActionController::Base.view_paths not used in ActionMailer deliver

Reported by Russell Quinn | February 3rd, 2009 @ 10:49 AM | in 2.x

I have a plugin that appends an extra directory to the view path in init.rb


ActionController::Base.append_view_path(File.join(directory, 'app/views'))

Which works fine, but when using ActionMailer it appears to ignore view_paths (or just takes the first one):


puts ActionController::Base.view_paths
CaseinNotification.deliver_new_user_information(self, casein_config_url, @form_password)

Results in


/Users/russell/Documents/Dev/Casein/Casein2/harness/app/views
/Users/russell/Documents/Dev/Casein/Casein2/harness/vendor/plugins/casein2/app/views
rake aborted!
Missing template casein_notification/new_user_information.erb in view path /Users/russell/Documents/Dev/Casein/Casein2/harness/app/views:

Comments and changes to this ticket

  • Russell Quinn

    Russell Quinn February 3rd, 2009 @ 11:05 AM

    Ahh.. yes.. ActionMailer uses ActionView and not ActionController to get its paths.

    The template root can be set on an ActionMail derived model level, e.g.:

    CaseinNotification.template_root = File.join(directory, 'app/views')

  • Ryan Bigg

    Ryan Bigg April 10th, 2010 @ 11:48 AM

    • Assigned user set to “Mikel Lindsaar”

    I gather this means that this is the solution to this problem then?

  • José Valim

    José Valim April 10th, 2010 @ 12:11 PM

    • State changed from “new” to “invalid”
    • Assigned user changed from “Mikel Lindsaar” to “José Valim”

    You need to append the view paths in both ActionController and ActionMailer.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages