On Wed, May 27, 2009 at 5:31 AM, Julian Leviston <jul...@coretech.net.au>wrote:
> > On 27/05/2009, at 9:16 PM, Conrad Taylor wrote: > > > An Array instance can respond to both count and size methods. If > > you use size the method with a counter > > cache column on the has_many side, you can cache the total. For > > example, you can do something > > like this > > > > Hi. Not sure where you got that from. > > Loading development environment (Rails 2.3.2) > >> [].count > NoMethodError: undefined method `count' for []:Array > from (irb):1 > >> [].size > => 0 > >> > > This statements are only true in Ruby prior to Ruby 1.8.6. For example, in Ruby 1.9.1, one can easily do the following: irb(main):001:0> [].count => 0 irb(main):002:0> [].size => 0 -Conrad > > ---------------------------------------------- > Learn: http://sensei.zenunit.com/ > Last updated 20-May-09 (Rails, Basic Unix) > Blog: http://random8.zenunit.com/ > Twitter: http://twitter.com/random8r > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---