If you use migrations to create a join table for a HABTM relationship, you should tell rails not to automatically add an id column in the migration (Agile book - 271).
Otherwise you will get a
Mysql::Error: Duplicate entry '#' for key #error.
create_table :authors_books, :id => false do |t|
t.column :author_id, :integer, :null => false
t.column :book_id, :integer, :null => false
end
6 comments:
Thanks, you saved me a lot of time!
thanks a lot dude!
Thank you! This really helped me out.
Triple everything everyone's already said! Thanks a bunch.
Wow... I guess I missed this tidbit or forgot about it. I'm glad I googled it before spending too much time digging through my code. Thanks!
Thanks! Saved me a lot of time
Post a Comment