Module: ActiveModel::DeprecatedErrorMethods
- Defined in:
- activemodel/lib/active_model/deprecated_error_methods.rb
Instance Method Summary (collapse)
- - (Object) add_to_base(msg)
- - (Object) each_full
- - (Boolean) invalid?(attribute)
- - (Object) on(attribute)
- - (Object) on_base
Instance Method Details
- (Object) add_to_base(msg)
18 19 20 21 |
# File 'activemodel/lib/active_model/deprecated_error_methods.rb', line 18 def add_to_base(msg) ActiveSupport::Deprecation.warn "Errors#add_to_base(msg) has been deprecated, use Errors#add(:base, msg) instead" self[:base] << msg end |
- (Object) each_full
28 29 30 31 |
# File 'activemodel/lib/active_model/deprecated_error_methods.rb', line 28 def each_full ActiveSupport::Deprecation.warn "Errors#each_full has been deprecated, use Errors#to_a.each instead" to_a.each { |error| yield error } end |
- (Boolean) invalid?(attribute)
23 24 25 26 |
# File 'activemodel/lib/active_model/deprecated_error_methods.rb', line 23 def invalid?(attribute) ActiveSupport::Deprecation.warn "Errors#invalid?(attribute) has been deprecated, use Errors#[attribute].any? instead" self[attribute].any? end |
- (Object) on(attribute)
3 4 5 6 7 8 9 10 11 |
# File 'activemodel/lib/active_model/deprecated_error_methods.rb', line 3 def on(attribute) = "Errors#on have been deprecated, use Errors#[] instead.\n" << "Also note that the behaviour of Errors#[] has changed. Errors#[] now always returns an Array. An empty Array is " << "returned when there are no errors on the specified attribute." ActiveSupport::Deprecation.warn() errors = self[attribute] errors.size < 2 ? errors.first : errors end |
- (Object) on_base
13 14 15 16 |
# File 'activemodel/lib/active_model/deprecated_error_methods.rb', line 13 def on_base ActiveSupport::Deprecation.warn "Errors#on_base have been deprecated, use Errors#[:base] instead" ActiveSupport::Deprecation.silence { on(:base) } end |