32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/cieloz/helpers.rb', line 32
def valid?
valid = _valid?
unless @source.nil?
unless valid
errors.messages.each { |attr,attr_errors|
source_attr = @opts[attr]
if source_attr.is_a?(Symbol) and @source.respond_to?(source_attr)
attr_errors.each {|e| @source.errors.add source_attr, e }
else
attr_errors.each {|e| @source.errors.add :base, "#{attr}: #{e}" if e.is_a? String }
end
@source.errors.messages.each {|attr,attr_errors| attr_errors.uniq! }
}
end
end
valid
end
|