Thilo-Alexander Ginkel
2010-Jan-25 02:00 UTC
ActionMailer does not find templates in production mode
Hello everyone, I am currently struggling with the following issue that only seems to appear in my production environment: When attempting to send a mail from an ActionMailer the template location algorithm does not seem to pick up the corresponding template: ActionView::MissingTemplate (Missing template event_mailer/approval_requested_notification.erb in view path app/views): app/models/event_observer.rb:3:in `after_enter_awaiting_approval'' /usr/lib/ruby/1.8/observer.rb:185:in `notify_observers'' /usr/lib/ruby/1.8/observer.rb:184:in `each'' /usr/lib/ruby/1.8/observer.rb:184:in `notify_observers'' (eval):10:in `create_or_update_without_callbacks'' app/controllers/event_controller.rb:71:in `request_approval'' public/dispatch.fcgi:24 However, I do have a corresponding template named "approval_requested_notification.text.plain.erb" in "app/views/event_mailer", which is correctly picked up in development mode. In production mode, however, the content type infix is omitted while searching for the template. This happens with Rails 2.3.4. Any suggestions how to sort this out are much appreciated! Thanks, Thilo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thilo-Alexander Ginkel
2010-Jan-25 21:56 UTC
Re: ActionMailer does not find templates in production mode
On Monday 25 January 2010 03:00:08 Thilo-Alexander Ginkel wrote:> I am currently struggling with the following issue that only seems to > appear in my production environment: > > When attempting to send a mail from an ActionMailer the template location > algorithm does not seem to pick up the corresponding template: > > ActionView::MissingTemplate (Missing template > event_mailer/approval_requested_notification.erb in view path app/views): > app/models/event_observer.rb:3:in `after_enter_awaiting_approval'' > /usr/lib/ruby/1.8/observer.rb:185:in `notify_observers'' > /usr/lib/ruby/1.8/observer.rb:184:in `each'' > /usr/lib/ruby/1.8/observer.rb:184:in `notify_observers'' > (eval):10:in `create_or_update_without_callbacks'' > app/controllers/event_controller.rb:71:in `request_approval'' > public/dispatch.fcgi:24turns out that the issue is related to the fact that mod_fcgi (used in production) sets a different working directory than WEBRick (used in development). The following code in environment.rb can be used as a workaround: # work around a mod_fcgi / ActionMailer bug Dir.chdir(File.dirname(__FILE__) << ''/../'') Regards, Thilo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.