On Thu, Mar 10, 2011 at 3:00 PM, danm <[email protected]> wrote: > I've got something weird happening in the code (using Rails 3.0). I > have a ton of has_many/belongs_to relationships in my application and > I save the child objects like this: > > if parent.child_collection << child > #do success code > else > #do error code > end > > The problem is that this ends up with duplicate child records in the > database, saved two seconds apart. The weird part is that this > happens when the user is using IE or Chrome, but NOT when using > Firefox. I'm wondering if this is Javascript related (I'm using > jQuery), but I do get two "Success" messages in Firefox even though it > only saves once. The #do success code uses Ajax to put up a view of > the parent object with the children in a table. > > Without seeing some actual code it is hard to tell exactly what the issue is. I would, on the suffurace, guess that your AJAX code is submitting the same request twice since you are seeing 2 successes in the browser. Start there for debugging.
B. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

