Module: WhyValidationsSuckIn96::ActiveRecord::ClassMethods

Defined in:
lib/whyvalidationssuckin96/rails/active_record/base_validation_overrides.rb

Instance Method Summary collapse

Instance Method Details

#validate(*args) ⇒ Object

FIXME - this is a seedy hack and i blame the entire contents of active_record/autosave_association.rb for it being necessary.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/whyvalidationssuckin96/rails/active_record/base_validation_overrides.rb', line 48

def validate(*args)
  return false unless WhyValidationsSuckIn96::ActiveRecord.warn_on_deprecation
  callstack = caller
  warn(<<-EOW.gsub(/^\s{10}/, ""))
    This is a friendly message from WhyValidationsSuckIn96. #{self.inspect} called 'validate' which is a
    deprecated method. The arguments given were:
    
      #{args.inspect} - #{block_given? ? 'block given' : 'no block given'}
      
    and the caller was:
    
      #{callstack.first}
    
    If these warnings are coming from a call to 'add_autosave_association_callbacks', do not be alarmed, as
    WhyValidationsSuckIn96 has implemented its own versions of the necessary validation callbacks.
      
    These warnings can be silenced by setting 'WhyValidationsSuckIn96::ActiveRecord.warn_on_deprecation' to false.
    You will now be returned to your regularly scheduled programming.
  EOW
  false
end