Class: ActiveModel::DeprecationHandlingMessageHash
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ActiveModel::DeprecationHandlingMessageHash
- Defined in:
- activemodel/lib/active_model/errors.rb
Instance Method Summary collapse
- #[]=(attribute, value) ⇒ Object
- #delete(attribute) ⇒ Object
-
#initialize(errors) ⇒ DeprecationHandlingMessageHash
constructor
A new instance of DeprecationHandlingMessageHash.
Constructor Details
#initialize(errors) ⇒ DeprecationHandlingMessageHash
Returns a new instance of DeprecationHandlingMessageHash.
554 555 556 557 |
# File 'activemodel/lib/active_model/errors.rb', line 554 def initialize(errors) @errors = errors super(prepare_content) end |
Instance Method Details
#[]=(attribute, value) ⇒ Object
559 560 561 562 563 564 565 566 567 568 |
# File 'activemodel/lib/active_model/errors.rb', line 559 def []=(attribute, value) ActiveSupport::Deprecation.warn("Calling `[]=` to an ActiveModel::Errors is deprecated. Please call `ActiveModel::Errors#add` instead.") @errors.delete(attribute) Array(value).each do || @errors.add(attribute, ) end __setobj__ prepare_content end |
#delete(attribute) ⇒ Object
570 571 572 573 574 |
# File 'activemodel/lib/active_model/errors.rb', line 570 def delete(attribute) ActiveSupport::Deprecation.warn("Calling `delete` to an ActiveModel::Errors messages hash is deprecated. Please call `ActiveModel::Errors#delete` instead.") @errors.delete(attribute) end |