Forum: Ruby on Rails NoMethodError on UserMailer:Class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6fa76b3113f66ea5055ad3f10ab92819?d=identicon&s=25 Grayson Piercee (grayson)
on 2008-11-12 19:21
I'm baffled but this error:

NoMethodError: undefined method `application_accepted' for
UserMailer:Class
        from
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer
/base.rb:385:in `method_missing'
        from D:/rails/app/models/applicant_observer.rb:11:in `after_
save'
        from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record
/observer.rb:171:in `send'
        from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record
/observer.rb:171:in `update'
        from c:/ruby/lib/ruby/1.8/observer.rb:185:in `notify_observers'
        from c:/ruby/lib/ruby/1.8/observer.rb:184:in `each'
        from c:/ruby/lib/ruby/1.8/observer.rb:184:in `notify_observers'

here is the class in question

require 'action_mailer/ar_mailer'
class UserMailer < ActionMailer::ARMailer

  def signup_notification(user)
    setup_email(user)
    @subject    += 'Welcome to'
  end

  def application_accepted(application)
    setup_email(application.position.account)
    @subject += "#{application.name} accepted."
    @body[:application] = application
  end

  protected
  def setup_email(user)
    recipients "#{user.email}"
    from       FROM_MAILER_STRING # Sets the User FROM Name and Email
    subject     ""
    body       :user => user
    sent_on    Time.now
  end
end

end


signup_notification works fine why would this other method?

Thanks,

GP
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2008-11-12 21:03
(Received via mailing list)
make sure you're calling it via
"UserMailer.create_application_accepted" or
"UserMailer.deliver_application_accepted", not just
"UserMailer.application_accepted"

On Nov 12, 1:21 pm, Grayson Piercee <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.