title: Rails: Relation with class_name does not get saved properly?
body: <p>I've got a (rather simple) model representing a comment:</p>
  
  <pre><code>class Comment &lt; ActiveRecord::Base
  
      STATES = [:processing, :accepted, :declined]
  
      belongs_to :note
      belongs_to :author, :class_name =&gt; 'User'
  
      validates_inclusion_of :state, :in =&gt; STATES
      validates_presence_of :author
  
      default_scope :order =&gt; 'created_at DESC'
  
      def initialize( attributes={} )
          super(attributes)
  
          self.state ||= 'processing'
      end
  end
  </code></pre>
  
  <p>However, everytime I save a comment (with its fields set properly), the author relation always fails to save (well, actually the comment saves successfully, it just leaves out the author...). This goes as far as <code>Comment.first.valid?</code> returning <code>false</code> due to the validation on the author field (<code>Comment.first.author</code> is <code>nil</code>).</p>
  
  <p>My suspicion is that I handle the default value for state-field in a wrong way? If so, how should I set the default value instead?</p>
  
  <p>thx for your help in advance</p>