Do not specify options[:message] for ActiveModel::Errors#add if it's nil
This commit is contained in:
parent
8d9637249c
commit
731338ed6c
|
@ -6,7 +6,9 @@ module CouchRest
|
|||
def validate_each(document, attribute, value)
|
||||
values = value.is_a?(Array) ? value : [value]
|
||||
return if values.collect {|doc| doc.nil? || doc.valid? }.all?
|
||||
document.errors.add(attribute, :invalid, :message => options[:message], :value => value)
|
||||
error_options = { :value => value }
|
||||
error_options[:message] = options[:message] if options[:message]
|
||||
document.errors.add(attribute, :invalid, error_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue