On 14 December 2011 14:35, Pieter Hugo <[email protected]> wrote:
> Hi Colin
>
> Thanks for the feedback. I kinda grokked that eventually. But I can't
> just turn my receive method into a class level method - because then the
> raw email string never gets turned into a tmail object. I any case the
> original code - which works, but doesnt pass my userid, is
>
> class PokeMailer < ActionMailer::Base
>  def receive(email)

That is an instance method.  To call it you would need a PokeMailer
object and then call it via
my_poke_mailer.receive(..)

>    ...
>  end
>
> I then invoke the receipt of email with
>
> task = PokeMailer.receive(m.pop)

You are asking here for a class method, so it will look for something
defined as
def self.receive()
Since you have not overridden that then presumably it will call an
existing method (I don't know PokeMailer so I can't comment on the
details).  It will not call your method.  Take your method out and see
if it still finds a method.

>
> Question - is this now a class method or an instance method? It gets
> called on the PokeMailer class, and responds, but its not defined with
> def self.receive.

not sure what you are asking here.  If you want to find out which
method it is calling have a look at the Rails Guide on debugging, it
will show you how to use ruby-debug to break into your code, you can
then step into the function and see where it goes.

>
> I suspect my ruby skills are woefully inadequate.... :(

So are mine, just possibly slightly less so.  The problem is that the
problem one is tackling often seems to require just a little more
knowledge than one's current state. :)

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to