Hi all- Long time lurker, first time writer. I have a rails app that takes a contact from an existing web app, (the user fills out a form), and then emails the contact to a reservationist for follow up. This is part of a step-wise replacement of the app. I run a cron every 10 minutes to take unprocessed records from the contact_log table, find the reservationist, and send them an email. [contact_log.rb] def self.find_unprocessed return find_all("procesed = 0") end This will run once, and then i start getting funky results. From that run forward, active record will show no contacts in the db, so nothing gets mailed. If i go straight to the database and run "SELECT * FROM contact_log WHERE processed = 0", i get a number of results. If i go into the console and run ContactLog.find_all, nothing, but ContactLog.connection.select_all("SELECT * FROM contact_log WHERE processed = 0") returns the expected results. Is something being cached? I can''t find any ruby processes running on the machine once the cron job is finished (actually, cron is a misnomer -- the machine is running win 2003). Any help or suggestions would be greatly appreciated. Thanks, lee ********************************* All that is gold does not glitter. Not all those who wander are lost. The old who are strong do not whither. Deep roots are not touched by the frost. -- J.R.R. Tolkein
* Lee Pope <lee-0KCFhs473bssV2N9l4h3zg@public.gmane.org> [0230 18:30]:> Hi all- > > Long time lurker, first time writer. > > I have a rails app that takes a contact from an existing web app, (the > user fills out a form), and then emails the contact to a reservationist > for follow up. This is part of a step-wise replacement of the app. I run > a cron every 10 minutes to take unprocessed records from the contact_log > table, find the reservationist, and send them an email. > > [contact_log.rb] > > def self.find_unprocessed > return find_all("procesed = 0") > end > > This will run once, and then i start getting funky results. From that > run forward, active record will show no contacts in the db, so nothing > gets mailed. If i go straight to the database and run "SELECT * FROM > contact_log WHERE processed = 0", i get a number of results. If i go > into the console and run ContactLog.find_all, nothing, but > ContactLog.connection.select_all("SELECT * FROM contact_log WHERE > processed = 0") returns the expected results.Have a look in your log/ subdirectory, it should tell you the sql being executed by rails. -- ''Blackmail''s such an ugly word. I prefer extortion. The x makes it sound cool.'' -- Bender Rasputin :: Jack of All Trades - Master of Nuns
> > def self.find_unprocessed > return find_all("procesed = 0") > endI don''t mean to be pedantic, and forgive me if it is, but is "procesed" the proper spelling of the column? Or was that just a typo in the email? -- Mando
Mando Escamilla wrote:>>def self.find_unprocessed >> return find_all("procesed = 0") >>end > > > I don''t mean to be pedantic, and forgive me if it is, but is > "procesed" the proper spelling of the column? Or was that just a typo > in the email? > > -- > MandoIt was a typo. :(