Hi,
This has been driving me crazy for the past couple of hours and I
can't seem to figure it out.

I'm using Fetcher (https://github.com/look/fetcher) to process an IMAP
email account.  Fetcher is doing its job just fine.  The problem seems
to be that I can't call any methods in my ActionMailer receive method
that require connecting to the database.

Attached my ActionMailer model that is invoked by the Fetcher daemon.
I can get the unsubscribe code out of the email body, which I print
out to the log just to check.  But the next line, where its trying to
find the subscription object by the unsubscribe code doesn't work.
Any method that requires a database lookup doesn't work.  Methods that
don't require a database call work fine.

The rails application stack seems to have loaded properly for this
daemon.  I assumed that part of that app load would include the info
about database connections.  Am I missing something?

Thanks,
Tay


class EmailIncoming < ActionMailer::Base

        def receive(mail)
                logger.info("Got a mail from #{mail.from} about: 
#{mail.subject}")

                #Do some regexp to get unsubscribe code out of email
body
                  .....
                logger.info("Unsubscribe code is #{code}")

                subscription =
EmailSubscribing.find_by_unsubscribe_code(code)
                subscription.update_attributes :status =>
'unsubscribed'

        end

end

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to