Hmmm... okay, now what if my primary key is autoincrementing?

On Oct 12, 2:31 pm, Aman Gupta <[email protected]> wrote:
> On Mon, Oct 12, 2009 at 2:29 PM, cult hero <[email protected]> wrote:
>
> > Okay, let's say I have a model instance and I want to create a new one
> > from that instance. What's the best way to do this?
>
> > I tried to cheat and just change the primary key and save it again,
> > but that didn't work!
>
> > So, let's say... model = MyModel[1]
>
> > Now I want to save model as a new row and change, like... 1 of 40
> > columns. What's the best way to do this?
>
> MyModel.create(model.values.merge(:id => 2))
>
>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to