module NestedAttributesValidatorUtil
Public Instance Methods
target_fields()
click to toggle source
# File lib/nested_attributes_validator/nested_attributes_validator_util.rb, line 3 def target_fields ([options[:fields]] || [:self]).flatten.map(&:to_s) end
target_values(fields, values)
click to toggle source
# File lib/nested_attributes_validator/nested_attributes_validator_util.rb, line 7 def target_values(fields, values) trg = values.inject({}) do |ret, v| ret[v] = fields.map{|f| v.send(f)} ret end if options[:ignore_nil] trg = trg.reject{|_k, v| v.all?(&:nil?)} end trg end