diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-03-25 15:13:22 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-03-25 15:13:22 -0300 |
commit | 833109cc99053cf25787ace09a9978a55c079112 (patch) | |
tree | 5083aeb8ed9cc31078b23fb29dda1bbdfae78bdc /activerecord | |
parent | e94e6c27af495a2460c811bb506459f1428dec6b (diff) | |
parent | ea3a73e720b5ffed6b6220dc9ce92776804cb06f (diff) | |
download | rails-833109cc99053cf25787ace09a9978a55c079112.tar.gz rails-833109cc99053cf25787ace09a9978a55c079112.tar.bz2 rails-833109cc99053cf25787ace09a9978a55c079112.zip |
Merge pull request #14390 from huoxito/true-touch
Still touch associations when theres no timestamp
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index c20499d081..1a2581f579 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -455,6 +455,8 @@ module ActiveRecord changed_attributes.except!(*changes.keys) primary_key = self.class.primary_key self.class.unscoped.where(primary_key => self[primary_key]).update_all(changes) == 1 + else + true end end diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 56ac284331..7994f76d08 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -340,6 +340,17 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_queries(1) { line_item.touch } end + def test_belongs_to_with_touch_option_on_touch_without_updated_at_attributes + assert !LineItem.column_names.include?("updated_at") + + line_item = LineItem.create! + invoice = Invoice.create!(line_items: [line_item]) + initial = invoice.updated_at + line_item.touch + + refute_equal initial, invoice.reload.updated_at + end + def test_belongs_to_with_touch_option_on_touch_and_removed_parent line_item = LineItem.create! Invoice.create!(line_items: [line_item]) |