search for: company_count

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

2008 May 29
7
when is a boolean not a boolean?
...mpany class (has lots of fields not really important to the problem below) Users can have many companies, entered into the User.rb model as one would expect has_many: :companies In the User.rb model I''ve also added: def has_companies? !companies.empty? end ..and.. def company_count companies.size end so I can easily find out if they actually have any companies and how many companies they have. Pretty straight-forward, right? I create users, every thing looks fine; I ask the user if it has any companies, if returns "false" as in: >> u1 = User.fin...