Running Rails 4 here. I just spent 2 hours trying to figure this out to no avail. Would someone please explain what I am doing wrong here? 

Step 1: Create Migration

```
rails g migration CreateJoinTableCommandContact command contact

```

Ste 2: Edit migration to add an additional `notification_type` column. 

```
class CreateJoinTableCommandContact < ActiveRecord::Migration
  def change
    create_join_table :commands, :contacts, :id => false do |t|
      t.index [:contact_id, :command_id]
      t.string "notification_type", :null => false
    end
  end
end

```

This results in a table names `commands_contacts` (both plural)

Step 3: Create models

command.rb

```
class Command < ActiveRecord::Base

  has_many :command_contacts
  has_many :contacts, :through => :command_contacts

end

```

contact.rb

```
class Contact < ActiveRecord::Base

    has_many :command_contacts

    has_many :host_commands, -> { where notification_type: 'host' }, class_name: 'CommandContact'
    has_many :host_notification_commands, :through => :host_commands, class_name: 'Command', :source => :command

    has_many :service_commands, -> { where notification_type: 'service' }, class_name: 'CommandContact'
    has_many :service_notification_commands, :through => :service_commands, class_name: 'Command', :source => :command

end

```

commands\_contacts.rb join model 

```
class CommandContact < ActiveRecord::Base

    belongs_to :command
    belongs_to :contact

end

```

Step 4: Test it.

```
irb(main):001:0> Contact.first.host_notification_commands

```

Which results in following error

```
  Contact Load (0.2ms)  SELECT  `contacts`.* FROM `contacts`  ORDER BY `contacts`.`id` ASC LIMIT 1
Mysql2::Error: Table 'ngconf_development.command_contacts' doesn't exist: SHOW FULL FIELDS FROM `command_contacts`
ActiveRecord::StatementInvalid: Mysql2::Error: Table 'ngconf_development.command_contacts' doesn't exist: SHOW FULL FIELDS FROM `command_contacts`

```

I have tried using every imaginable combination of command(s) and contact(s) in my migration and models, but still can't get this to work. What am i doing wrong here?

Why is it trying to use command\_contacts with command in singular form?