module Sequel::Plugins::ErrorSplitter::InstanceMethods

  1. lib/sequel/plugins/error_splitter.rb
Parent: ErrorSplitter

Methods

Public Instance

  1. _valid?

Public Instance methods

_valid? (*)

If the model instance is not valid, go through all of the errors entries. For any that apply to multiple columns, remove them and add separate error entries, one per column.

[show source]
# File lib/sequel/plugins/error_splitter.rb, line 36
def _valid?(*)
  v = super
  unless v
    errors.keys.select{|k| k.is_a?(Array)}.each do |ks|
      msgs = errors.delete(ks)
      ks.each do |k|
        msgs.each do |msg|
          errors.add(k, msg)
        end
      end
    end
  end
  v
end