Module: ActsAsParanoidValidationFix::ActiveRecordAdditions

Defined in:
lib/acts_as_paranoid_dag/validation_fix.rb

Instance Method Summary collapse

Instance Method Details

#validates(*attributes) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/acts_as_paranoid_dag/validation_fix.rb', line 11

def validates( *attributes )

  # The extension is only needed, if the instance has a :deleted_at attribute.
  if self.new.respond_to?( :deleted_at )
    if ( attributes[ 1 ] )
      if ( attributes[ 1 ][ :uniqueness ] )
        if ( attributes[ 1 ][ :uniqueness ][ :scope ] )
          attributes[ 1 ][ :uniqueness ][ :scope ] += [ :deleted_at ]
        end
      end
    end
  end
  super *attributes

end