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/test/cases | |
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/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index f895f8b8d2..195889f1df 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -545,6 +545,14 @@ class RelationTest < ActiveRecord::TestCase assert_equal 'hen', hen.name end + def test_explicit_create_scope + hens = Bird.where(:name => 'hen') + assert_equal 'hen', hens.new.name + + hens = hens.create_with(:name => 'cock') + assert_equal 'cock', hens.new.name + end + def test_except relation = Post.where(:author_id => 1).order('id ASC').limit(1) assert_equal [posts(:welcome)], relation.all |