Strange problem about mailer - no template found

send mail in console, failed for the first time, but successfully sent
after reloading…, following are my code snippet:

class Mailer < ActionMailer::Base
def notification()

end
end

class Model < ActiveRecord::Base
def self.send_notifications
mail=Mailer.create_notification()
mail.set_content_type(‘text/html;charset=utf-8’)
Mailer.deliver(mail)
end
end

1 script/console

2 Model.send_notifitions
#failed
ActionView::ActionViewError: No rhtml, rxml, rjs or delegate template
found for notifications in /mailer
from
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:399:in
find_template_extension_for' from /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:335:inpick_template_extension’
from
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:249:in
render_file' from /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/base.rb:283:inrender’
from
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:481:in
render' from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:476:inrender_message’
from
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:424:in
create!' from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:385:ininitialize’
from
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:332:in
new' from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mailer/base.rb:332:inmethod_missing’
from ./script/…/config/…/config/…/app/models/model.rb:200:in
`send_notifications’

3 reload!
#ok

4 Model.send_notifitions
#sent successfully

how strange, anybody knows? thanks

sorry, the error stack is

ActionView::ActionViewError: No rhtml, rxml, rjs or delegate template
found for notification in /mailer

notification.rhtml does exits in /mailer. anyone knows? thanks a lot.

and my rails version is 1.2.3, system is macos…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs