Skip to content

Instantly share code, notes, and snippets.

@mcmire
Created May 7, 2009 15:35
Show Gist options
  • Save mcmire/108167 to your computer and use it in GitHub Desktop.
Save mcmire/108167 to your computer and use it in GitHub Desktop.
ActionMailer plain text layout fix
# 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