diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/timestamp.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/timestamp_test.rb | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb index 38cc2c9694..65d9d1fb19 100644 --- a/activerecord/lib/active_record/timestamp.rb +++ b/activerecord/lib/active_record/timestamp.rb @@ -74,6 +74,10 @@ module ActiveRecord timestamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) } end + def all_timestamp_attributes_in_model + timestamp_attributes_for_create_in_model + timestamp_attributes_for_update_in_model + end + def timestamp_attributes_for_update #:nodoc: [:updated_at, :updated_on] end diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb index 62e3a084d0..1c21f0f3b6 100644 --- a/activerecord/test/cases/timestamp_test.rb +++ b/activerecord/test/cases/timestamp_test.rb @@ -165,4 +165,9 @@ class TimestampTest < ActiveRecord::TestCase toy = Toy.first assert_equal toy.send(:timestamp_attributes_for_update_in_model), [:updated_at] end + + def test_all_timestamp_attributes_in_model + toy = Toy.first + assert_equal toy.send(:all_timestamp_attributes_in_model), [:created_at, :updated_at] + end end |