Edge rails: Now create HABTM join tables easily using migration helper

Published on Author Akhil BansalLeave a comment

Earlier whenever we wanted to create a HABTM join table, we do this like:

# Creating a migration and adding code like:
 create_table :categories_products, :id => false do |t|
   t.integer :product_id, :null => false
   t.integer :category_id, :null => false
 end

Now, in edge rails after this commit we can use a migration helper for the same:

# Now, using migration helper
create_join_table :products, :categories

Leave a Reply

Your email address will not be published. Required fields are marked *