Q: Should rails associations throw an error if there is no foreign key in the database? 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?
See the following situation:
$> rails new mynewapp
$> cd mynewapp
$> rails g model User
$> rails g model Whatever
$> rake db:migrate

#user.rb
belongs_to :whatever

$> rails c
   u = User.new
   u.save
   w = Whatever.new
   w.save
   u.whatever = w
   u.save #no error!  

   u.whatever               #=> w(Whatever)
   u.reload                 #=> w(Whatever)
   User.find(u.id).whatever #=> nil!!!!!!

I see this behavior on rails v3.2.3

A: This is the expected behavior, as associations don't always involve a user_id type column. If you think this should throw an error, this is probably better suited for the rails github issues page, or the rails development mailing list.
