Forum: Ruby on Rails Layouts in ActionMailer

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.
Iain A. (Guest)
on 2009-03-17 15:09
(Received via mailing list)
Hiya

I am having loads of trouble adding layouts to my emails in rails 2.2.

I created a layout app/views/layouts/notifier.html.erb and this layout
was used for all my emails regardless of content type. All was well.

But I want to create a different layout for the different content
types (text/html, text/plain)

In which case I made app/views/layout/notifier.text.html.erb and app/
views/layouts/notifier.text.plain.erb

as described here
http://guides.rubyonrails.org/action_mailer_basics...

class Notifier < ActionMailer::Base

  layout 'notifier'

  def reminder
     ...
     content_type 'text/html'
     ...
  end
end

Now it won't render either layout. I get the error

ActionView::MissingTemplate (Missing layout layouts/notifier.erb in
view path /home/rails/test/app/views:):
    /opt/csw/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/
template.rb:95:in `find_full_path'


Has anyone got any ideas?? I'd be very grateful
This topic is locked and can not be replied to.