class ActiveRecord::UnknownAttributeError

Parent:
NoMethodError

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.

Attributes

attribute[R]
record[R]

Public Class Methods

new(record, attribute) Show source
# File activemodel/lib/active_model/errors.rb, line 595
def initialize(record, attribute)
  @record = record
  @attribute = attribute
  super("unknown attribute '#{attribute}' for #{@record.class}.")
end
Calls superclass method

© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.