Scott Kulik wrote:
Scott Kulik wrote:
Scott Kulik wrote:
Sazima wrote:
Maybe s.items.count is zero?
Cheers, Sazima
On Dec 19, 5:01�am, Scott Kulik rails-mailing-l...@andreas-s.net
hmm...it shouldn't be since @user.items.count in my view shows the count
correctly for each user.
Maybe s.items.count is zero?
Cheers, Sazima
On Dec 19, 5:01 am, Scott Kulik rails-mailing-l...@andreas-s.net
wrote:
Bryce Roney wrote:
You can run a migration like this
def self.up
User.find(:all) do |u|
u.update_attribute :items_count, s.items.count
end
end
That
Sazima wrote:
Maybe s.items.count is zero?
Cheers, Sazima
On Dec 19, 5:01�am, Scott Kulik rails-mailing-l...@andreas-s.net
hmm...it shouldn't be since @user.items.count in my view shows the count
correctly for each user.
--
Posted via http://www.ruby-forum.com/.
Scott Kulik wrote:
Sazima wrote:
Maybe s.items.count is zero?
Cheers, Sazima
On Dec 19, 5:01�am, Scott Kulik rails-mailing-l...@andreas-s.net
hmm...it shouldn't be since @user.items.count in my view shows the count
correctly for each user.
is there another i can do it like this but
Scott Kulik wrote:
Scott Kulik wrote:
Sazima wrote:
Maybe s.items.count is zero?
Cheers, Sazima
On Dec 19, 5:01�am, Scott Kulik rails-mailing-l...@andreas-s.net
hmm...it shouldn't be since @user.items.count in my view shows the count
correctly for each user.
is there another i
bah...i figured it out. i didn't have a default value of 0 set in the
field so it wasn't updating. now it's working!
the only thing now is that i have a couple thousand users who have 0 for
the count values. what do you think is the best way i can mass update
this field?
--
Posted via
You can run a migration like this
def self.up
User.find(:all) do |u|
u.update_attribute :items_count, s.items.count
end
end
That will go through all your users and update the items_count field
for all of them.
~~~
Bryce Roney
[ twitter ][ blog ][ myspace ][ facebook ]
Bryce Roney wrote:
You can run a migration like this
def self.up
User.find(:all) do |u|
u.update_attribute :items_count, s.items.count
end
end
That will go through all your users and update the items_count field
for all of them.
~~~
Bryce Roney
[ twitter ][
Oh sorry! I was copying the code out of a project I had.
change s.items.count to u.items.count
-- Bryce Roney
On 19/12/2008, at 12:13 PM, Scott Kulik wrote:
Bryce Roney wrote:
You can run a migration like this
def self.up
User.find(:all) do |u|
u.update_attribute :items_count,
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
Bryce Roney wrote:
You can run a migration like this
def self.up
User.find(:all) do |u|
u.update_attribute :items_count, s.items.count
end
end
That will go through all your users and update the items_count field
for all of them.
~~~
Bryce Roney
[ twitter ][
11 matches
Mail list logo