Module: Sequel::Plugins::DefaultOrder::DatasetMethods
- Defined in:
- lib/sequel/plugins/default_order.rb
Instance Method Summary collapse
Instance Method Details
#from_original_dataset ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sequel/plugins/default_order.rb', line 21 def from_original_dataset new_opts = opts.dup # opts[:order] is frozen but we need to modify it new_opts[:order] = opts[:order]&.reject { |o| o == model.custom_default_order } # If order is empty, delete the key to avoid adding empty ORDER BY clause new_opts.delete(:order) if new_opts[:order]&.empty? db[model.table_name].clone(new_opts) end |