title: Rails 3.1, why I get ActiveRecord::UnknownAttributeError: unknown attribute in spec test?
body: <p>I am trying to create a <code>Student</code> record in a test, like this:</p>
  
  <pre><code>student= Student.create!(:work_phone =&gt; "1234567890")
  </code></pre>
  
  <p>but I get this error:</p>
  
  <pre><code>ActiveRecord::UnknownAttributeError: unknown attribute: work_phone
  </code></pre>
  
  <p>However, <code>work_phone</code> is defined in the <code>Student</code> model, and migrated. </p>
  
  <p>Here is the <code>Student</code>model:</p>
  
  <pre><code>class Student &lt; ActiveRecord::Base
  
    validates_length_of :work_phone, :is =&gt; 10, :message =&gt; 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if =&gt; Proc.new{|o| !o.work_phone.blank?}
  
    attr_accessible:work_phone
  
  end
  </code></pre>
  
  <p>Any idea?</p>