search for: coupon_us

Displaying 1 result from an estimated 1 matches for "coupon_us".

Did you mean: coupon_uses
2006 Jul 11
1
counter_cache, has_many and belongs_to
...hy would you need to cache the number of associated objects? Wouldnt the has_many association need the counter cache instead since you never know how many records are linked? Maybe I''m just not understanding something, but here is the snippet I am using: class Coupon has_many :coupon_uses, :counter_cache => :uses_count end Now I could just do "coupon.coupon_uses.size" but there will be very large number of associated objects and would rather not even visit the table if I don''t need to. -- Posted via http://www.ruby-forum.com/.