Hi all !
There''s something I''m missing here... Here''s the
code:
class Tracker < ActiveRecord::Base
belongs_to :user
has_many :results, :class_name => ''TrackerResult'',
:exclusively_dependent => true
validates_presence_of :title
def crawl()
logger.info "Before: #{last_trackered_at}"
last_trackered_at = Time.now
logger.info "After: #{last_trackered_at}"
unless save then
logger.error "Tracker #{id}: #{errors.full_messages}"
return
end
logger.info "After save: #{last_trackered_at}"
end
end
The problem is that the last_trackered_at column in the DB doesn''t
change value from NULL... Here''s an excerpt from my log:
Before:
After: Wed Jun 08 10:27:39 Est (heure d''été) 2005
SQL (0.000000) BEGIN
Tracker Update (0.000000) UPDATE trackers SET `created_at` =
''2005-06-07 10:56:19'', `title` =
''Google.com'', `start_page` =
''http://www.google.com/intl/en/jobs/index.html'', `query_page`
= '''',
`user_id` = 1, `updated_on` = ''2005-06-08 10:27:39'',
`track_now` = 1,
`post_arguments` = '''', `last_trackered_at` = NULL WHERE id = 1
SQL (0.000000) COMMIT
After save: Wed Jun 08 10:27:39 Est (heure d''été) 2005
You can see in the SQL above that last_trackered_at is explicitely set
to NULL.
I''ve been trying to get that working for the past hour or so, and I
can''t seem to find the solution. I''m sure either I will find
the
solution 10 seconds after I send the E-Mail, or someone will kindly
remind me to read some manual somewhere :)
Besides, I have another column, named track_now (defined as "integer not
null" in the DB) which exhibits the same behavior.
Thanks !
François