On May 23, 5:08 pm, Nate Wiger <[email protected]> wrote: > 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?
In certain cases, yes. It does the query to get the values of all of the columns, so that it works correctly with database defaults. Let's say column a has a default value of 5. Without doing the refresh, if you did: Model.create.a You would get nil instead of 5. Note that on PostgreSQL (and I think on Firebird too), Sequel doesn't need to send a query to refresh, since it uses INSERT RETURNING, so that the column values are returned when the insert is done. You can certainly modify Sequel not to do the refresh. It currently requires modifying a fairly large method (_save), but it could be easily refactored that to make it easier to override. Jeremy -- 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.
