diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-03 03:24:28 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-03 03:24:28 +0530 |
commit | 6f5f23aaa7c4673fe923c6ad1450baaeccb40c02 (patch) | |
tree | b1314b211da78667eb80a8b4c93f68c2acae35c7 /activerecord/lib/active_record/relation | |
parent | c51347152abc7d8a97fd8df3eecfdbfd07673b68 (diff) | |
download | rails-6f5f23aaa7c4673fe923c6ad1450baaeccb40c02.tar.gz rails-6f5f23aaa7c4673fe923c6ad1450baaeccb40c02.tar.bz2 rails-6f5f23aaa7c4673fe923c6ad1450baaeccb40c02.zip |
Add Relation#includes to be an equivalent of current finder option :include
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 4600aab574..cf2cc7ba70 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -5,6 +5,10 @@ module ActiveRecord spawn.tap {|r| r.preload_associations += Array.wrap(associations) } end + def includes(*associations) + spawn.tap {|r| r.include_associations += Array.wrap(associations) } + end + def eager_load(*associations) spawn.tap {|r| r.eager_load_associations += Array.wrap(associations) } end |