Sha256: 031577fcd66464dd34e9d5c416d7a78d6c32f65e57f0d5283bb6f3f002c178e1
Contents?: true
Size: 719 Bytes
Versions: 1
Compression:
Stored size: 719 Bytes
Contents
module Zuora module Models module Utils # Calls `validate_each` on for each provided attribute. # Attaches error generated via message fragment. # e.g. 'invalid widget' # # @param [Object] sender; # @param [String] message # @param [Array<Symbol>] fields # @return [Nil] def self.validate_children(sender, message, *fields) sender.validates_each fields do |record, attr, value| if !value.respond_to?(:valid?) || !value.respond_to?(:errors) record.errors.add attr, "invalid #{message}" elsif value.invalid? record.errors.add attr, value.errors.join(',') end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zuora-ruby-0.1.0 | lib/zuora/models/utils.rb |