Created
April 10, 2012 17:09
-
-
Save greyblake/2352914 to your computer and use it in GitHub Desktop.
ActionMailer bug?
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
# When everything work | |
class TestMailer < ActionMailer::Base | |
default :from => "[email protected]", :to => "[email protected]" | |
def hello | |
mail do |format| | |
format.text { render :text => "Hello!" } | |
format.html { render :text => "<h1>Hello!</h1>" } | |
end | |
end | |
end | |
hello_email = TestMailer.hello | |
hello_email.text_part.body.to_s # => "Hello!" | |
hello_email.html_part.body.to_s # => "<h1>Hello!</h1>" | |
################################################################################## | |
# When nothing works!!! | |
class TestMailer < ActionMailer::Base | |
default :from => "[email protected]", :to => "[email protected]" | |
def hello | |
mail do |format| | |
format.text { render :text => "Hello!" } | |
# We just commented it out | |
# format.html { render :text => "<h1>Hello!</h1>" } | |
end | |
end | |
end | |
hello_email = TestMailer.hello | |
hello_email.html_part # => nil, it's OK | |
hello_email.text_part # => nil, WTF? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment