title: Should rails associations throw an error if there is no foreign key in the database?
body: <p>In the case of a belongs_to association, it seems that rails allows you to set the association even if there is no corresponding foreign key in the table.  Is this expected behavior?</p>
  
  <p>See the following situation:</p>
  
  <pre><code>$&gt; rails new mynewapp
  $&gt; cd mynewapp
  $&gt; rails g model User
  $&gt; rails g model Whatever
  $&gt; rake db:migrate
  
  #user.rb
  belongs_to :whatever
  
  $&gt; rails c
     u = User.new
     u.save
     w = Whatever.new
     w.save
     u.whatever = w
     u.save #no error!  
  
     u.whatever               #=&gt; w(Whatever)
     u.reload                 #=&gt; w(Whatever)
     User.find(u.id).whatever #=&gt; nil!!!!!!
  </code></pre>
  
  <p>I see this behavior on rails v3.2.3</p>