Thanks a lot Jeremy, for the quick response and the information! I changed my code, and now i am using your suggestion and works great.
Have a nice weekend! Regards, Ornella. El viernes, 5 de agosto de 2016, 12:51:51 (UTC-3), Jeremy Evans escribió: > > On Friday, August 5, 2016 at 7:50:46 AM UTC-7, Ornella Bordino wrote: >> >> Good morning! >> >> When i clone (or dup) an instance, the generated clone has the same >> primary key instead of a new one. >> > > This is expected. It wouldn't be a copy of the object if it had a > different primary key. > > If you want to have a new instance with the same values other than the > primary key, you probably want something like: > > h = user_1.values.dup > h.delete[User.primary_key] > user_2 = User.create(h) > > Thanks, > Jeremy > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
