Rails 3.1, pourquoi je reçois ActiveRecord::UnknownAttributeError: inconnu attribut spec test?

Je suis en train de créer un Student enregistrement dans un test, comme ceci:

student= Student.create!(:work_phone => "1234567890")

mais j'obtiens cette erreur:

ActiveRecord::UnknownAttributeError: unknown attribute: work_phone

Cependant, work_phone est définie dans le Student modèle, et a migré.

Ici est la Studentmodèle:

class Student < ActiveRecord::Base

  validates_length_of :work_phone, :is => 10, :message => 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if => Proc.new{|o| !o.work_phone.blank?}

  attr_accessible:work_phone

end

Une idée?

OriginalL'auteur simo | 2012-01-04