Created
September 13, 2012 14:52
-
-
Save garethrees/3714817 to your computer and use it in GitHub Desktop.
Rails Association CollectionProxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ugh Rails Association CollectionProxy! | |
| https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/collection_proxy.rb | |
| >> CountryProfile.all == Site.first.country_profiles | |
| => true | |
| >> CountryProfile.all.count(:group => 'region') | |
| => 0 | |
| >> Site.country_profiles.count(:group => 'region') | |
| => #<OrderedHash {"Africa"=>4, "Asia"=>3, "Middle East/Eastern Europe"=>1, "Latin America"=>1}> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment