A project has a MySQL database. There are Agencies, each has_many
Donors, each Donor belongs_to :agency, :counter_cache => true.

On my development machine the donors_count field in Agency looks good,
and I wrote and tested a rake task to set it properly for all
Agencies.

On production the count for one Agency was set by the rake task to 3,
but I can't see the records in the console:

>> agency=Agency.find(27)
=> #<Agency id: 27, name: ... , donors_count: 3>
>> agency.donors.size
=> 3
>> agency.donors
=> []

Where are the donors that it counted? My GUI tool for MySQL in Ubuntu,
HeidiSQL, shows me that they're there. If I search for one I know is
there on production:

>> donor=Donor.find(18706)
ActiveRecord::RecordNotFound: Couldn't find Donor with ID=18706
        from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/
activerecord-2.3.5/lib/active_record/base.rb:1586:in `find_one'
        ....

where I can find that same record on my machine fine. And on
production finding a similar record belonging to a different Agency
works fine:

>> donor=Donor.find(18455)
=> #<Donor id: 18455, internal_id: "May2490", ...

Any ideas? Is the production database corrupted?

Thanks,

Scott

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

Reply via email to