mirror of https://github.com/rails/rails
A few documentation fixes [ci skip]
This commit is contained in:
parent
707144a31e
commit
e09129c94c
|
@ -69,8 +69,8 @@ module ActionView
|
|||
# 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
|
||||
#
|
||||
# With the <tt>scope</tt> you can define a custom scope for Rails lookup
|
||||
# the translation.
|
||||
# With the <tt>scope</tt> option, you can define a custom scope for Rails
|
||||
# to lookup the translation.
|
||||
#
|
||||
# For example you can define the following in your locale (e.g. en.yml).
|
||||
#
|
||||
|
@ -78,8 +78,8 @@ module ActionView
|
|||
# distance_in_words:
|
||||
# short:
|
||||
# about_x_hours:
|
||||
# one: 1 hr
|
||||
# other: '%{count} hr'
|
||||
# one: 'an hour'
|
||||
# other: '%{count} hours'
|
||||
#
|
||||
# See https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml
|
||||
# for more examples.
|
||||
|
@ -87,8 +87,8 @@ module ActionView
|
|||
# Which will then result in the following:
|
||||
#
|
||||
# from_time = Time.now
|
||||
# distance_of_time_in_words(from_time, from_time + 50.minutes, scope: 'datetime.distance_in_words.short') # => 1 hr
|
||||
# distance_of_time_in_words(from_time, from_time + 3.hours, scope: 'datetime.distance_in_words.short') # => 3 hr
|
||||
# distance_of_time_in_words(from_time, from_time + 50.minutes, scope: 'datetime.distance_in_words.short') # => "an hour"
|
||||
# distance_of_time_in_words(from_time, from_time + 3.hours, scope: 'datetime.distance_in_words.short') # => "3 hours"
|
||||
def distance_of_time_in_words(from_time, to_time = 0, options = {})
|
||||
options = {
|
||||
scope: :'datetime.distance_in_words'
|
||||
|
|
|
@ -98,7 +98,7 @@ module ActiveModel
|
|||
|
||||
module HelperMethods
|
||||
|
||||
# Validates that the specified attribute matches the length restrictions
|
||||
# Validates that the specified attributes match the length restrictions
|
||||
# supplied. Only one option can be used at a time:
|
||||
#
|
||||
# class Person < ActiveRecord::Base
|
||||
|
|
|
@ -22,7 +22,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
module ClassMethods
|
||||
# Validates that the specified attributes matches the length restrictions supplied.
|
||||
# Validates that the specified attributes match the length restrictions supplied.
|
||||
# If the attribute is an association, records that are marked for destruction are not counted.
|
||||
#
|
||||
# See ActiveModel::Validations::HelperMethods.validates_length_of for more information.
|
||||
|
|
Loading…
Reference in New Issue