Permalink
Browse files

Merge pull request #6182 from shaliko/change_unless_else_into_if_else

Change unless + else into if + else
  • Loading branch information...
2 parents cf243be + 5a2a72d commit c35df123f040450a314d8cd8a950c09aff39b315 @josevalim josevalim committed May 7, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 actionpack/lib/action_view/helpers/date_helper.rb
@@ -66,12 +66,12 @@ module DateHelper
# 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 = {})
- unless include_seconds_or_options.is_a?(Hash)
+ 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", caller
options[:include_seconds] ||= !!include_seconds_or_options
- else
- options = include_seconds_or_options
end
from_time = from_time.to_time if from_time.respond_to?(:to_time)

0 comments on commit c35df12

Please sign in to comment.