Module: ActiveRecord::Validate
- Defined in:
- lib/vex/active_record/validate.rb
Class Method Summary collapse
Class Method Details
.all(quiet = nil, &block) ⇒ Object
2 3 4 5 6 |
# File 'lib/vex/active_record/validate.rb', line 2 def self.all(quiet=nil, &block) klasses(quiet).inject(0) do |count, klass| count += invalid_models(klass, quiet).length end end |
.purge ⇒ Object
8 9 10 11 12 13 |
# File 'lib/vex/active_record/validate.rb', line 8 def self.purge klasses(true).each do |klass| invalids = invalid_models(klass, true) klass.delete_all [ "id IN (?)", invalids.map(&:id) ] unless invalids.empty? end end |
.set_klass_for(opts) ⇒ Object
16 17 18 19 |
# File 'lib/vex/active_record/validate.rb', line 16 def self.set_klass_for(opts) @klass_for_table ||= {} @klass_for_table.update opts.with_indifferent_access end |