Since I’ve been developing my code and data at the same time my count
columns are off. Some say 0 (the default) instead of the actual.
Is there some way to run something like this in irb:
puts “Refreshed size = #{author.books_count(:refresh).size}”
except for all *_count columns in each table?
I’m probably dreaming but it would be nice if there was a way to easily
do this.
Since I’ve been developing my code and data at the same time my count
columns are off. Some say 0 (the default) instead of the actual.
Is there some way to run something like this in irb:
puts “Refreshed size = #{author.books_count(:refresh).size}”
except for all *_count columns in each table?
I’m probably dreaming but it would be nice if there was a way to easily
do this.
Denormalization is a bitch, huh? Considered dropping the count columns
altogether?
a = Author.find(:all)
for i in a
i.update_attribute(:books_count, i.books.size)
i.update_attribute(:articles_count, i.articles.size)
i.update_attribute(:lectures_count, i.lectures.size)
end
DAN
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.