Sure, insert will put it into the DB, but that will bypass all the validations/etc.
Shouldn't it be possible for Sequel to have a reference to the item without making a DB roundtrip? On May 23, 4:39 pm, pete <[email protected]> wrote: > On Sun, May 23, 2010 at 4:11 PM, Nate Wiger <[email protected]> wrote: > > I have some simple code that just does this: > > > User.create(attributes) > > > But I noticed performance seemed a bit sluggish when creating a few > > records in a row. So I turned on debug logging and I see this: > > > I, [2010-05-23T15:32:06.564780 #96222] INFO -- : BEGIN > > I, [2010-05-23T15:32:06.565013 #96222] INFO -- : INSERT INTO `users` > > (`username`) VALUES ('nwiger') > > I, [2010-05-23T15:32:06.565377 #96222] INFO -- : SELECT * FROM > > `users` WHERE (`id` = 368) LIMIT 1 > > I, [2010-05-23T15:32:06.565701 #96222] INFO -- : COMMIT > > > Does this mean Sequel is re-fetching the record after saving it? If > > so, is there any way to disable this? Seems that if I want to > > guarantee consistency, I should just call refresh() myself. > > > Thanks, > > Nate > > > -- > > 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]<sequel-talk%2bunsubscr...@googlegr > > oups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/sequel-talk?hl=en. > > This is done so that sequel has a reference to the thing it just put in the > database. Model#create is useful if you need to create a record and then > immediately do something with it. If you just need to create a record, > Model#insert or Model#multi_insert is probably what you want. > > pete > > -- > 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 > athttp://groups.google.com/group/sequel-talk?hl=en. -- 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.
