module Sequel::Plugins::InsertReturningSelect
If the model's dataset selects explicit columns and the database supports it, the insert_returning_select plugin will automatically set the RETURNING clause on the dataset used to insert rows to the columns selected, which allows the default model support to run the insert and refresh of the data in a single query, instead of two separate queries. This is Sequel's default behavior when the model does not select explicit columns.
Usage:
# Make all model subclasses automatically setup insert returning clauses Sequel::Model.plugin :insert_returning_select # Make the Album class automatically setup insert returning clauses Album.plugin :insert_returning_select
Public Class Methods
configure(model)
click to toggle source
Modify the current model's dataset selection, if the model has a dataset.
# File lib/sequel/plugins/insert_returning_select.rb 23 def self.configure(model) 24 model.instance_exec do 25 self.dataset = dataset if @dataset && @dataset.opts[:select] 26 end 27 end