Rails dies when I try to call a method from my Mailer. But I have defined my method. What could I have missed? Here is the irb session:
p = Person.find(1) => Person data…
SiteMailer.request_admin_approval(p) NoMethodError: undefined method `request_admin_approval’ for SiteMailer:Class
SiteMailer.method_defined? :request_admin_approval => true
It is true… there is a method named request_admin_approval for SiteMailer… but it is an instance method (as in: s = SiteMailer.new s.request_admin_approval(p) )
You’re trying to access it as a class method… which means, you would need to define self.request_admin_approval in the SiteMailer class instead of just request_admin_approval.
Or, you will have to make an instance of your SiteMailer object in order to call the function.