File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ * Remove ability to specify a timestamp name for ` #cache_key ` .
2+
3+ * Rafael Mendonça França*
4+
15* Remove deprecated ` ActiveRecord::Migrator.migrations_path= ` .
26
37 * Rafael Mendonça França*
Original file line number Diff line number Diff line change @@ -61,23 +61,14 @@ def to_param
6161 #
6262 # Product.cache_versioning = false
6363 # Product.find(5).cache_key # => "products/5-20071224150000" (updated_at available)
64- def cache_key ( * timestamp_names )
64+ def cache_key
6565 if new_record?
6666 "#{ model_name . cache_key } /new"
6767 else
68- if cache_version && timestamp_names . none?
68+ if cache_version
6969 "#{ model_name . cache_key } /#{ id } "
7070 else
71- timestamp = if timestamp_names . any?
72- ActiveSupport ::Deprecation . warn ( <<-MSG . squish )
73- Specifying a timestamp name for #cache_key has been deprecated in favor of
74- the explicit #cache_version method that can be overwritten.
75- MSG
76-
77- max_updated_column_timestamp ( timestamp_names )
78- else
79- max_updated_column_timestamp
80- end
71+ timestamp = max_updated_column_timestamp
8172
8273 if timestamp
8374 timestamp = timestamp . utc . to_s ( cache_timestamp_format )
Original file line number Diff line number Diff line change @@ -133,11 +133,10 @@ def current_time_from_proper_timezone
133133 self . class . send ( :current_time_from_proper_timezone )
134134 end
135135
136- def max_updated_column_timestamp ( timestamp_names = timestamp_attributes_for_update_in_model )
137- timestamp_names
138- . map { |attr | self [ attr ] }
136+ def max_updated_column_timestamp
137+ timestamp_attributes_for_update_in_model
138+ . map { |attr | self [ attr ] &. to_time }
139139 . compact
140- . map ( &:to_time )
141140 . max
142141 end
143142
Original file line number Diff line number Diff line change @@ -191,21 +191,6 @@ def test_cache_version_format_is_not_too_precise
191191 end
192192 end
193193
194- def test_named_timestamps_for_cache_key
195- assert_deprecated do
196- owner = owners ( :blackbeard )
197- assert_equal "owners/#{ owner . id } -#{ owner . happy_at . utc . to_s ( :usec ) } " , owner . cache_key ( :updated_at , :happy_at )
198- end
199- end
200-
201- def test_cache_key_when_named_timestamp_is_nil
202- assert_deprecated do
203- owner = owners ( :blackbeard )
204- owner . happy_at = nil
205- assert_equal "owners/#{ owner . id } " , owner . cache_key ( :happy_at )
206- end
207- end
208-
209194 def test_cache_key_is_stable_with_versioning_on
210195 with_cache_versioning do
211196 developer = Developer . first
You can’t perform that action at this time.
0 commit comments