I understand that count and length should return the same number for Ruby arrays. So I canβt understand whatβs going on here (FactoryGirl is set up to create - save the database - by default):
f = Factory(:family)
I vaguely understand why f needs to be reloaded, although I expected f.members to include a database search for members with family_id=f.id and will return all members, even if f is deprecated.
But how can the bill differ from the length? f.members is an Array, but is the count method overridden somewhere, or does Array.count actually return a different result from Array.length? Not a real problem, just a secret that may indicate a major flaw in my understanding of Ruby or Rails.
source share