About this user

Kyle http://www.unlogikal.net

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

Creating a table with migrations when using has_and_belongs_to_many

You can find the information at http://api.rubyonrails.org under the "create_table" method. The short answer is this though,

create_table :table_name, :id => false do |t|

end


:id is the part you're looking for, it defaults to true, which creates the :id as an autoincrementing primary key, if you use migrations and want to create the join table, you don't want an "id" column, so use :id => false to override the create_table method and tell it you don't want that primary key.
« Newer Snippets
Older Snippets »
1 total  XML / RSS feed