Created
May 7, 2009 15:35
-
-
Save mcmire/108167 to your computer and use it in GitHub Desktop.
ActionMailer plain text layout fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Patch Rails so that a plain text mailer view won't be rendered with the layout | |
# Only tested in Rails 2.2 - I'm not sure how this works with 2.3 | |
module ActionMailer | |
class Base | |
def candidate_for_layout?(options) | |
return false if ActionView::Template === options[:file] && options[:file].content_type == "text/plain" | |
!@template.send(:_exempt_from_layout?, default_template_name) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment