Added foreign_key option

After discussion on #8630 I've checked HABTM against master and derivation of join table name works properly. But there's another thing here, if we change table name we'll want to see that foreign key will be changed too.
```ruby
module Namespace
  class Base < ActiveRecord::Base
    self.table_name = 'tablename'
    has_and_belongs_to_many :somethings
  end
end
```
In case above foreign_key for HABTM will be `base_id`, and for all associations we have to set it manually. I decided to add new option for it, this way we can set it for the whole class and descendants. Any other suggestions? /cc @pixeltrix