Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @landlord = Landlord.first
- # generates a SQL query for the associated properties collection
- @landlord.properties.size # => 30, or whatever
- @landlord.properties.size # => 30; no additional SQL query generated
- # generates the following SQL in Rails 2.3.5:
- # SELECT count(*) AS count_all FROM `properties` WHERE (`properties`.landlord_id = 1)
- @landlord.properties.count # => 30
Add Comment
Please, Sign In to add comment