Module: ActiveModel::Warnings::ClassMethods
- Defined in:
- lib/activemodel-warnings.rb
Instance Method Summary collapse
Instance Method Details
#validate(*args, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/activemodel-warnings.rb', line 22 def validate(*args, &block) = args. if [:warning] || @warnings_block = .dup [:warning] ||= @warnings_block [:if] = Array.wrap([:if]) [:if] << "skip_warnings != true" end args << super end |
#validates_with(*args, &block) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/activemodel-warnings.rb', line 36 def validates_with(*args, &block) = args. if [:warning] || @warnings_block = .dup [:warning] ||= @warnings_block end args << super end |
#warnings ⇒ Object
15 16 17 18 19 20 |
# File 'lib/activemodel-warnings.rb', line 15 def warnings() @warnings_block = true yield ensure @warnings_block = false end |