Spec-Zone.ru › Ruby on Rails 6.0

класс ActiveRecord::UnknownAttributeError

Родитель:
NoMethodError

Вызывается, когда неизвестные атрибуты предоставляются через массовое назначение.

class Person
  include ActiveModel::AttributeAssignment
  include ActiveModel::Validations
end

person = Person.new
person.assign_attributes(name: 'Gorby')
# => ActiveModel::UnknownAttributeError: unknown attribute 'name' for Person.

Атрибуты

attribute[R]
record[R]

Публичные методы класса

new(record, attribute) Показать исходный код
# 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
Вызывает метод суперкласса

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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API