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

On Oct 10, 12:41 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Oct 10, 5:32 pm, gaveeno <[EMAIL PROTECTED]> wrote:
>
> > Anybody know why this isn't working for me?
>
> Well you haven't said exactly what is happening, eg if you put a
> breakpoint in create_incoming_message is it hit? have you tried
> stepping through the code and seeing when it fails?
> Could it be that creation of the incoming_message fails because of
> validation? Do you really mean to be creating class instance
> variables ?
>
> Fred
--~--~---------~--~----~------------~-------~--~----~
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