mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove the deprecated include_seconds argument from distance_of_time_in_words
Pass in an :include_seconds hash option to use this feature.
This commit is contained in:
parent
127d16e0be
commit
6b9356a4b7
2 changed files with 7 additions and 10 deletions
|
@ -1,4 +1,9 @@
|
||||||
* Remove deprecated block passing to FormBuilder#new.
|
* Remove the deprecated `include_seconds` argument from `distance_of_time_in_words`,
|
||||||
|
pass in an `:include_seconds` hash option to use this feature.
|
||||||
|
|
||||||
|
*Carlos Antonio da Silva*
|
||||||
|
|
||||||
|
* Remove deprecated block passing to `FormBuilder#new`.
|
||||||
|
|
||||||
*Vipul A M*
|
*Vipul A M*
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,7 @@ module ActionView
|
||||||
# distance_of_time_in_words(from_time, to_time, include_seconds: true) # => about 6 years
|
# distance_of_time_in_words(from_time, to_time, include_seconds: true) # => about 6 years
|
||||||
# distance_of_time_in_words(to_time, from_time, include_seconds: true) # => about 6 years
|
# distance_of_time_in_words(to_time, from_time, include_seconds: true) # => about 6 years
|
||||||
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
|
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
|
||||||
def distance_of_time_in_words(from_time, to_time = 0, include_seconds_or_options = {}, options = {})
|
def distance_of_time_in_words(from_time, to_time = 0, options = {})
|
||||||
if include_seconds_or_options.is_a?(Hash)
|
|
||||||
options = include_seconds_or_options
|
|
||||||
else
|
|
||||||
ActiveSupport::Deprecation.warn "distance_of_time_in_words and time_ago_in_words now accept :include_seconds " +
|
|
||||||
"as a part of options hash, not a boolean argument"
|
|
||||||
options[:include_seconds] ||= !!include_seconds_or_options
|
|
||||||
end
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
scope: :'datetime.distance_in_words'
|
scope: :'datetime.distance_in_words'
|
||||||
}.merge!(options)
|
}.merge!(options)
|
||||||
|
|
Loading…
Reference in a new issue