Exception: ActiveModel::UnknownAttributeError
- Inherits:
 - 
      NoMethodError
      
        
- Object
 - NoMethodError
 - ActiveModel::UnknownAttributeError
 
 
- Defined in:
 - lib/active_model/errors.rb
 
Overview
Active Model UnknownAttributeError
Raised when unknown attributes are supplied via mass assignment.
class Person
  include ActiveModel::AttributeAssignment
  include ActiveModel::Validations
end
person = Person.new
person.assign_attributes(name: 'Gorby')
# => ActiveModel::UnknownAttributeError: unknown attribute 'name' for Person.
  Instance Attribute Summary collapse
- 
  
    
      #attribute  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute attribute.
 - 
  
    
      #record  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute record.
 
Instance Method Summary collapse
- 
  
    
      #initialize(record, attribute)  ⇒ UnknownAttributeError 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of UnknownAttributeError.
 
Constructor Details
#initialize(record, attribute) ⇒ UnknownAttributeError
Returns a new instance of UnknownAttributeError.
      541 542 543 544 545  | 
    
      # File 'lib/active_model/errors.rb', line 541 def initialize(record, attribute) @record = record @attribute = attribute super("unknown attribute '#{attribute}' for #{@record.class}.") end  | 
  
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
      539 540 541  | 
    
      # File 'lib/active_model/errors.rb', line 539 def attribute @attribute end  | 
  
#record ⇒ Object (readonly)
Returns the value of attribute record.
      539 540 541  | 
    
      # File 'lib/active_model/errors.rb', line 539 def record @record end  |