Skip to content

Instantly share code, notes, and snippets.

@cmrd-senya
Last active July 25, 2018 08:48
Show Gist options
  • Save cmrd-senya/3680eeb40a446ccb2548a62643c671de to your computer and use it in GitHub Desktop.
Save cmrd-senya/3680eeb40a446ccb2548a62643c671de to your computer and use it in GitHub Desktop.
Sequel plugin to override default select_append behaviour which adds '*' to select query if there is no prior selections
module Sequel::Plugins::SelectAppendNoDefaultAll
module DatasetMethods
def select_append(*columns, &block)
cur_sel = @opts[:select]
return select(*columns, &block) if !cur_sel || cur_sel.empty?
select(*(cur_sel + columns), &block)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment