The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
What's New in Edge Rails: Mailer Layouts

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
rwdaigle

Posts: 312
Nickname: rwdaigle
Registered: Feb, 2003

Ryan is a passionate ruby developer with a strong Java background.
What's New in Edge Rails: Mailer Layouts Posted: Sep 7, 2008 5:15 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by rwdaigle.
Original Post: What's New in Edge Rails: Mailer Layouts
Feed Title: Ryan's Scraps
Feed URL: http://feeds.feedburner.com/RyansScraps
Feed Description: Ryan Daigle's various technically inclined rants along w/ the "What's new in Edge Rails" series.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by rwdaigle
Latest Posts From Ryan's Scraps

Advertisement

Rails mailer templates now have the ability to utilize layouts just like their view-template siblings. The only caveat is that for a mailer layout to be automatically recognized it must end with _mailer. So this mailer:

1
2
3
4
5
6
class UserMailer < ActionMailer::Base
  def registration(user)
    subject    "You've registered"
    from       "system@example.com"
  end
end

would need a layout at layouts/user_mailer.html.erb. If you explicitly specify the layout it doesn’t need the _mailer suffix. So, in this example, a layout at layouts/email.html.erb would suffice:

1
2
3
4
class UserMailer < ActionMailer::Base
  layout 'email'
  ...
end

Go forth and make your emails pretty. You’ve got all the tools now…

tags: ruby, rubyonrails

Read: What's New in Edge Rails: Mailer Layouts

Topic: Capistrano dry run Previous Topic   Next Topic Topic: I'm putting myself on notice

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use