On 6 Apr 2009, at 00:10, Morgan Morgan wrote:
> example: say i wanted to see how many records showed female in the
> users
> table but i didn't actually want to pull a bunch of info, i just want
> the number returned.
Use the count method: Person.count("gender", :conditions=>["gender=?",
"female"])
There are more calculation methods available in the ActiveRecord
Calculations model if you check the documentation.
-Matt
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---