mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
minor stuff
This commit is contained in:
parent
9e2d95c3e1
commit
d89266d9f1
@ -84,7 +84,7 @@ module ValidatesTimeliness
|
||||
restriction = [restriction] unless restriction.is_a?(Array)
|
||||
|
||||
if defined?(I18n)
|
||||
message = custom_error_messages[option] || I18n.translate('activerecord.errors.messages')[option]
|
||||
message = custom_error_messages[option] || I18n.t('activerecord.errors.messages')[option]
|
||||
subs = message.scan(/\{\{([^\}]*)\}\}/)
|
||||
interpolations = {}
|
||||
subs.each_with_index {|s, i| interpolations[s[0].to_sym] = restriction[i].strftime(format) }
|
||||
@ -150,16 +150,16 @@ module ValidatesTimeliness
|
||||
class << self
|
||||
|
||||
def default_error_messages
|
||||
if Rails::VERSION::STRING < '2.2'
|
||||
::ActiveRecord::Errors.default_error_messages
|
||||
if defined?(I18n)
|
||||
I18n.t('activerecord.errors.messages')
|
||||
else
|
||||
I18n.translate('activerecord.errors.messages')
|
||||
::ActiveRecord::Errors.default_error_messages
|
||||
end
|
||||
end
|
||||
|
||||
def error_value_formats
|
||||
if defined?(I18n)
|
||||
I18n.translate('validates_timeliness.error_value_formats')
|
||||
I18n.t('validates_timeliness.error_value_formats')
|
||||
else
|
||||
@@error_value_formats
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user