Class: ActiveRecord::Error
- Inherits:
-
Object
- Object
- ActiveRecord::Error
- Defined in:
- lib/active_record/validations.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#base ⇒ Object
Returns the value of attribute base.
-
#message ⇒ Object
(also: #to_s)
Returns the value of attribute message.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #full_message ⇒ Object
-
#initialize(base, attribute, type = nil, options = {}) ⇒ Error
constructor
A new instance of Error.
- #value ⇒ Object
Constructor Details
#initialize(base, attribute, type = nil, options = {}) ⇒ Error
Returns a new instance of Error.
21 22 23 24 25 26 27 |
# File 'lib/active_record/validations.rb', line 21 def initialize(base, attribute, type = nil, = {}) self.base = base self.attribute = attribute self.type = type || :invalid self. = self. = .delete(:message) || self.type end |
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute.
19 20 21 |
# File 'lib/active_record/validations.rb', line 19 def attribute @attribute end |
#base ⇒ Object
Returns the value of attribute base.
19 20 21 |
# File 'lib/active_record/validations.rb', line 19 def base @base end |
#message ⇒ Object Also known as: to_s
Returns the value of attribute message.
19 20 21 |
# File 'lib/active_record/validations.rb', line 19 def @message end |
#options ⇒ Object
Returns the value of attribute options.
19 20 21 |
# File 'lib/active_record/validations.rb', line 19 def @options end |
#type ⇒ Object
Returns the value of attribute type.
19 20 21 |
# File 'lib/active_record/validations.rb', line 19 def type @type end |
Instance Method Details
#full_message ⇒ Object
35 36 37 |
# File 'lib/active_record/validations.rb', line 35 def attribute.to_s == 'base' ? : () end |
#value ⇒ Object
41 42 43 |
# File 'lib/active_record/validations.rb', line 41 def value @base.respond_to?(attribute) ? @base.send(attribute) : nil end |