diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-04 03:50:16 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-04 03:50:16 +0530 |
commit | a68165833a7ba50a1e3d731afe8934d19e3ced99 (patch) | |
tree | afb89f08afb126f1464298f7d3da719490912399 /activerecord/lib/active_record/relation/query_methods.rb | |
parent | a115b5d79a850bb56cd3c9db9a05d6da35e3d7be (diff) | |
download | rails-a68165833a7ba50a1e3d731afe8934d19e3ced99.tar.gz rails-a68165833a7ba50a1e3d731afe8934d19e3ced99.tar.bz2 rails-a68165833a7ba50a1e3d731afe8934d19e3ced99.zip |
Add Relation#create_with to explictily specify create scope
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-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 525a9cb365..5d7bf0b7bc 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -17,6 +17,10 @@ module ActiveRecord spawn.tap {|r| r.readonly = status } end + def create_with(attributes = {}) + spawn.tap {|r| r.create_with_attributes = attributes } + end + def select(selects) if selects.present? relation = spawn(@relation.project(selects)) |