Guys,
Anyone ever had this kind of problem with ActiveScaffold?
Cheers, Sazima
------------------------------------------------------------------------------------------------
What steps will reproduce the problem?
1. Create self-referential HABTM application (like the common "user
has friends" example)
2. Try to add more than 1 friend to a given user using ActiveScaffold.
What is the expected output? What do you see instead?
2+ friends related to the user. Instead I get a MySQL error:
ActiveRecord::StatementInvalid (Mysql::Error: Duplicate entry
''4'' for
key
1: INSERT INTO friends (`updated_at`, `id`, `user_id`, `created_at`,
`friend_id`) VALUES (''2008-01-22 20:27:49'', 4, 2,
''2008-01-22
20:26:31'', 4))
What version (or revision) of the product are you using?
1.1.1 + Rails 2.0.2 (InstantRails 2 installation)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Keynan Pratt
2008-Jan-24 08:35 UTC
Re: Self-referential HABTM SQL mal-formed when updating reco
friend_id is a key (ie it must be unique) this is a DB schema error. not a rails error. Just remove the key definition around that column -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- Self-referential has_many :through relationship
- How to access attribute in a self-referential many-to-many relationship
- Self-Referential Many-To-Many relationships where the relationship itself has data.
- Self-referential MtoM implementation
- Bi-directional self-referential HABTM