This is most likely a noob question since people use this gem and a lot of people love it, but I don't get the purpose. I'm looking at a project and its been used here many times in places such as t.references :foreign_key_table_name , :foreign_key => true
, add_foreign_key :table :foreign_key_table_name, :options
, and in a create t.foreign_key :foreign_key_table_name
. Hope those weren't confusing since they're out of context.
But I don't get how this is different from what rails does built in with t.references :foreign_key_table_name
or from me just adding t.integer :foreign_key_table_name_id
? does it simply make it more readable by making clear that this is a 'foreign key'? I could just add a comment instead of a gem if thats the case... The only advantage I see is that you can move options such as :dependent
into the migration instead of having it in the model, but who cares?