Bryce Roney wrote:
> Oh sorry! I was copying the code out of a project I had.
>
> change s.items.count to u.items.count
>
>
> -- Bryce Roney
np!
i just tried it with the new code and it says its successful again but
items_count is still showing 0. i checked @user.items.count in one of
my views and that works fine...must be something small. here is my
output of the migration:
sku...@kuliksco-ub:/u1/app/wldev$ rake db:migrate
(in /u1/app/wldev)
== 20081218000000 UpdateItemsCount: migrating
=================================
== 20081218000000 UpdateItemsCount: migrated (0.1271s)
========================
sku...@kuliksco-ub:/u1/app/wldev$ cat
db/migrate/20081218000000_update_items_count.rb
class UpdateItemsCount < ActiveRecord::Migration
def self.up
User.find(:all) do |u|
u.update_attribute :items_count, u.items.count
end
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---