Monday, April 29, 2013

[Rails] ActiveRecord HasAndBelongsToManyAssociationWithPrimaryKeyError

Im trying to upgrade an app from rails 2.3 to rails 3.0

I get the following error in rails 3.0.6 environment

Error message:
Primary key is not allowed in a has_and_belongs_to_many join table
(appointment_label).
(ActiveRecord::HasAndBelongsToManyAssociationWithPrimaryKeyError)

Exception class:
ActiveRecord::HasAndBelongsToManyAssociationWithPrimaryKeyError

seems primary key should be removed from "appointment_label" so I
removed the primary key column and it did worked PERFECT!!

But what I don't get is the app worked fine in rails 2.3 environment
even with primary key in the table "appointment_label" but not in rails
3.0.6 environment ????

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate