diff options
-rw-r--r-- | activerecord/CHANGELOG.md | 2 | ||||
-rw-r--r-- | activerecord/test/cases/base_test.rb | 23 | ||||
-rw-r--r-- | guides/source/migrations.md | 2 |
3 files changed, 2 insertions, 25 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 8ee179951f..00b2c431ac 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -240,7 +240,7 @@ * Improve ways to write `change` migrations, making the old `up` & `down` methods no longer necessary. * The methods `drop_table` and `remove_column` are now reversible, as long as the necessary information is given. - The method `remove_column` used to accept multiple column names; instead use `remove_columns` (which is not revertible). + The method `remove_column` used to accept multiple column names; instead use `remove_columns` (which is not reversible). The method `change_table` is also reversible, as long as its block doesn't call `remove`, `change` or `change_default` * New method `reversible` makes it possible to specify code to be run when migrating up or down. diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 286e0be105..fbc66540d6 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -327,29 +327,6 @@ class BasicsTest < ActiveRecord::TestCase assert !cbs[1].frickinawesome end - def test_first_or_create - parrot = Bird.first_or_create(:color => 'green', :name => 'parrot') - assert parrot.persisted? - the_same_parrot = Bird.first_or_create(:color => 'yellow', :name => 'macaw') - assert_equal parrot, the_same_parrot - end - - def test_first_or_create_bang - assert_raises(ActiveRecord::RecordInvalid) { Bird.first_or_create! } - parrot = Bird.first_or_create!(:color => 'green', :name => 'parrot') - assert parrot.persisted? - the_same_parrot = Bird.first_or_create!(:color => 'yellow', :name => 'macaw') - assert_equal parrot, the_same_parrot - end - - def test_first_or_initialize - parrot = Bird.first_or_initialize(:color => 'green', :name => 'parrot') - assert_kind_of Bird, parrot - assert !parrot.persisted? - assert parrot.new_record? - assert parrot.valid? - end - def test_load topics = Topic.all.merge!(:order => 'id').to_a assert_equal(4, topics.size) diff --git a/guides/source/migrations.md b/guides/source/migrations.md index cefbc3b829..c4fbae8925 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -444,7 +444,7 @@ class ExampleMigration < ActiveRecord::Migration end ``` -Using `reversible` will insure that the instructions are executed in the +Using `reversible` will ensure that the instructions are executed in the right order too. If the previous example migration is reverted, the `down` block will be run after the `home_page_url` column is removed and right before the table `products` is dropped. |