mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
Update validator.rb
tweak message key lookup
This commit is contained in:
parent
e9c9914c4f
commit
da473b7eea
@ -91,7 +91,7 @@ module ValidatesTimeliness
|
||||
|
||||
def add_error(record, attr_name, message, value=nil)
|
||||
value = format_error_value(value) if value
|
||||
message_options = { :message => (options[:"#{message}_message"] || options[:message]), :restriction => value }
|
||||
message_options = { :message => options.fetch(:"#{message}_message", options[:message]), :restriction => value }
|
||||
record.errors.add(attr_name, message, message_options)
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user