Created
August 6, 2010 19:21
-
-
Save sukima/511836 to your computer and use it in GitHub Desktop.
ActiveMailer syntax error
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
class ApplicationMailer < ActionMailer::Base | |
def welcome_email(instructor) | |
recipients instructor.email | |
from APP_CONFIG['system_email_address'] | |
subject "Welcome to #{APP_CONFIG['application_name']}. Thank you for registering." | |
sent_on Time.now | |
body {:instructor => instructor} | |
end | |
end |
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
suki[SimNotify] (feature/mailer)$ script/console | |
Loading development environment (Rails 2.3.8) | |
>> ApplicationMailer.deliver_welcome_email("test") | |
SyntaxError: /Users/suki/source/SimNotify/app/models/application_mailer.rb:7: syntax error, unexpected tASSOC, expecting '}' | |
body {:instructor => instructor} | |
^ | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:380:in `load_file' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:379:in `load_file' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:259:in `require_or_load' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:425:in `load_missing_constant' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing' | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing' | |
from (irb):1 | |
>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Attempting to use the examples from Action Mailer Basics will cause the above error. Instead remove the curly brackets:
This will work. I have no idea why the docs say otherwise.