Why would I receive an error message that looks like this: <2optin_railshq_net-bi+AKbBUZKaPsj7gpdEXHh3dCYHtlxm/@public.gmane.org> (expanded from <2optin-2cQghv03O8bR7s880joybQ@public.gmane.org>): Command died with status 1: "/opt/ruby-enterprise-1.8.6-20090610/bin/ruby /var/www/rails/railshq.net/script/runner ''Emailer.receive2optin(STDIN.read)''". Command output: /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/ rails-2.3.2/lib/commands/runner.rb:48: undefined method `receive2optin'' for Emailer:Class (NoMethodError) from When my action mailer class looks like this: class Emailer < ActionMailer::Base # First method omitted for simplicity def receive2optin(email) outfile=File.open(''/tmp/debug1'',''w'') outfile.puts(email.from[0]) outfile.close end end Any thoughts would be appreciated. Thanks. ... doug -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jeffrey L. Taylor
2009-Nov-29 07:08 UTC
Re: runner complaining that existing method is missing
Quoting doug <ddjolley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Why would I receive an error message that looks like this: > > <2optin_railshq_net-bi+AKbBUZKaPsj7gpdEXHh3dCYHtlxm/@public.gmane.org> (expanded from > <2optin-2cQghv03O8bR7s880joybQ@public.gmane.org>): Command died with status 1: > "/opt/ruby-enterprise-1.8.6-20090610/bin/ruby > /var/www/rails/railshq.net/script/runner > ''Emailer.receive2optin(STDIN.read)''". Command output: > /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/ > rails-2.3.2/lib/commands/runner.rb:48: > undefined method `receive2optin'' for Emailer:Class > (NoMethodError) from > > When my action mailer class looks like this: > > class Emailer < ActionMailer::Base > # First method omitted for simplicity > def receive2optin(email) > outfile=File.open(''/tmp/debug1'',''w'') > outfile.puts(email.from[0]) > outfile.close > end > end >Short, smart ass answer: the script calls a class method, the code defines an instance method. However, ActionMailer has some smoke and mirrors so that if you change the script to call Emailer.deliver_receive2optin(STDIN.read), it will do what you probably want. Jeffrey -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> Short, smart ass answer: the script calls a class method, the code defines an > instance method. However, ActionMailer has some smoke and mirrors so that if > you change the script to call Emailer.deliver_receive2optin(STDIN.read), it > will do what you probably want.Wow!! I doubt that I would have ever figured that out. I have read tons of documentation on the "receiving email" issue and I''ve never seen any mention of this. So, you''ve now bailed me out on two issues and this one finally put me over the top. It now works! I was under the impression that my email argument was an object so that I could extract things like email.body and email.from[0]. That doesn''t seem to be the case. email doesn''t appear to be an object at all but rather just a variable containing the full text of the email including both header and body. It would be really nice if I had an object so that I could conveniently get at the respective components. In any event, you''ve been most helpful. The proof of the pudding is in the eating, and IT WORKS! Thanks a batch for the help. ... doug -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.