mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Implement and test private method all_timestamp_attributes_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
This commit is contained in:
parent
47315760bc
commit
a5b03e9c7a
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue