Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionController::Base.view_paths not used in ActionMailer deliver

#1858

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:

Reported by Russell Quinn · February 3rd, 2009 @ 10:49 AM

State: invalid
Milestone: 2.x
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Russell Quinn
    Russell Quinn

    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')

    February 3rd, 2009 @ 11:05 AM

  2. Ryan Bigg
    Ryan Bigg
    • Assigned user set to Mikel Lindsaar

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

    April 10th, 2010 @ 11:48 AM

  3. José Valim
    José Valim
    • 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.

    April 10th, 2010 @ 12:11 PM