I've verified this, if someone thinks I'm still not getting it please explain to me. But, unless my English is bad, I believe that the gem is documented incorrectly. The correct syntax is actually:
add_foreign_key(to_table, from_table, options)
So with that I would do add_foreign_key :entry_ingredients, :entries, :dependent => :delete
This logic says to me, add a foreign key to the table entry_ingredients, from table entries as entry_id, with options...
While by the documentations logic I would use this code add_foreign_key :entries, :entry_ingredients, :dependent => :delete
which says to me, add a foreign key from entries (as entry_id), to entry_ingredients, with options... However, what in fact happens is we are adding a foreign key to entries, from entry_ingredients (as entry_ingredients_id). This is wrong, and not the intended result. Here is the error I receive when following the documentations method to prove it:
Mysql2::Error: Key column 'entry_ingredient_id' doesn't exist in table: ALTER TABLE `entries` ADD CONSTRAINT `entries_entry_ingredient_id_fk` FOREIGN KEY (`entry_ingredient_id`) REFERENCES `entry_ingredients`(id) ON DELETE CASCADE
I've reported this as an issue on github so hopefully he fixes the documentation.