diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-14 08:47:42 -0800 |
---|---|---|
committer | Steve Klabnik <steve@steveklabnik.com> | 2012-09-21 15:36:23 +0300 |
commit | b8fba557e139830cbc180bc11dbf92990f53edc5 (patch) | |
tree | e2a8c1966ef8650d609c0740e67d67ed5a444386 /activerecord/test | |
parent | 98f80218d4a588bd4bcace2ae534b9a791d381f9 (diff) | |
download | rails-b8fba557e139830cbc180bc11dbf92990f53edc5.tar.gz rails-b8fba557e139830cbc180bc11dbf92990f53edc5.tar.bz2 rails-b8fba557e139830cbc180bc11dbf92990f53edc5.zip |
Merge pull request #3544 from amatsuda/_field_changed
Rename field_changed? to _field_changed? so that users can create a field named field
Conflicts:
activerecord/lib/active_record/core.rb
activerecord/test/cases/dirty_test.rb
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index 3bd2e909d7..4fc7e77786 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -521,6 +521,20 @@ class DirtyTest < ActiveRecord::TestCase assert !pirate.previous_changes.key?('created_on') end + if ActiveRecord::Base.connection.supports_migrations? + class Testings < ActiveRecord::Base; end + def test_field_named_field + ActiveRecord::Base.connection.create_table :testings do |t| + t.string :field + end + assert_nothing_raised do + Testings.new.attributes + end + ensure + ActiveRecord::Base.connection.drop_table :testings rescue nil + end + end + def test_setting_time_attributes_with_time_zone_field_to_same_time_should_not_be_marked_as_a_change in_time_zone 'Paris' do target = Class.new(ActiveRecord::Base) @@ -530,7 +544,7 @@ class DirtyTest < ActiveRecord::TestCase pirate = target.create(:created_on => created_on) pirate.reload # Here mysql truncate the usec value to 0 - + pirate.created_on = created_on assert !pirate.created_on_changed? end |