When you ask if I really mean to be creating class instance variables,
I assume you're referring to @incoming_message,
@opt_or_feedback_object, @processing_notes =
IncomingMessage.process_message()...correct? The reason I set class
instance variables is because the view for this action needs to
display details from the incoming message, the object created from the
the incoming message, and the notes that are generated during
processing (including the validation results mostly). I didn't paste
the last line of the IncomingMessage.process_message() method above,
but FYI it is "return
@incoming_message,@opt_or_feedback_object,@processed_msg_array[0]".
No, the reason is not that it's failing because of validations within
the IncomingMessage.process_message() method, because the terminal
window shows now SQL being executed, and also there are items
persisted to the DB regardless of whether validation succeeds or
fails. I took your tip and used breakpoints to see what's happening
here (this is my first Rails app and I stupidly didn't think to look
into the Rails debug tools). When a SMS comes in, the breakpoint at
the start of the IncomingMessage.process_message() method is hit.
However, when an email comes in, not breakpoints are hit, regardless
of where they are. I.e. in the MailProcesser.receive() method, I put
the following 2 lines:
1 puts "debug"
2 debugger
The terminal window where I executed the script displays "debug", but
processing does not stop at the breakpoint.
This might help...it's the fetcher script that is daemonized (and I
can post more of the code from the Fetcher plugin if you think that
it'd be helpful):
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment.rb'
class MailFetcherDaemon < Daemon::Base
@config = YAML.load_file("#{RAILS_ROOT}/config/mail.yml")
@config = @config[RAILS_ENV].to_options
@sleep_time = @config.delete(:sleep_time) || 60
def self.start
puts "Starting MailFetcherDaemon"
@fetcher = Fetcher.create({:receiver =>
MailProcessor}.merge(@config))
loop do
@fetcher.fetch
sleep(@sleep_time)
end
end
def self.stop
puts "Stopping MailFetcherDaemon"
end
end
MailFetcherDaemon.daemonize
Thanks for your help!
-Gavin