[Rails] Help with Many-To-Many insert
Rodrigo Alvarez Fernández
papipo at gmail.com
Wed Mar 1 16:32:46 GMT 2006
On 3/1/06, Buntin, Seth - KATE <Seth.Buntin at coe.murraystate.edu> wrote:
>
> I am having issues with a many-to-many table. The table relates
> resources to standards, but in my resources table has one-to-many
> relationships so those also appear in my many-to-many table. I am trying to
> insert into the table via:
>
>
>
> @resource.core_contents << CoreContent.find(params[:core_content_ids])
>
>
>
> But I get this error:
>
>
>
> Mysql::Error: Duplicate entry '0-0-0-0-0-0' for key 1: INSERT INTO core_contents_resources () VALUES ()
>
>
>
> What is the problem?
>
It seems that you have defined five fields of that table UNIQUE. Since you
already have a record in that table with value 0 in each of those, no more
records can be inserted with such values.
Thanks for the help.
>
>
>
> Seth Buntin
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060301/f856da39/attachment.html
More information about the Rails
mailing list