aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2016-01-07 16:38:39 -0600
committerschneems <richard.schneeman@gmail.com>2016-01-08 14:29:31 -0600
commit57155064d135d67e0624d561c2badfe018b27a3a (patch)
tree4f3468cd57aa612c07811af8f033dc89a214ac7d /activerecord/test/cases
parent76c385709c873a7105e3a267d84c4e70417a15e2 (diff)
downloadrails-57155064d135d67e0624d561c2badfe018b27a3a.tar.gz
rails-57155064d135d67e0624d561c2badfe018b27a3a.tar.bz2
rails-57155064d135d67e0624d561c2badfe018b27a3a.zip
Get update_attributes working with SchemaMigration
You cannot use `update_attributes` on models that do not have a primary key. Since SchemaMigration versions are guaranteed to be unique (they have a unique index on them) we can safely use them as a primary key.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/ar_schema_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb
index 9d5327bf35..1f32c48b95 100644
--- a/activerecord/test/cases/ar_schema_test.rb
+++ b/activerecord/test/cases/ar_schema_test.rb
@@ -21,10 +21,10 @@ if ActiveRecord::Base.connection.supports_migrations?
ActiveRecord::Migration.verbose = @original_verbose
end
- def test_has_no_primary_key
+ def test_has_has_primary_key
old_primary_key_prefix_type = ActiveRecord::Base.primary_key_prefix_type
ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore
- assert_nil ActiveRecord::SchemaMigration.primary_key
+ assert_equal "version", ActiveRecord::SchemaMigration.primary_key
ActiveRecord::SchemaMigration.create_table
assert_difference "ActiveRecord::SchemaMigration.count", 1 do