Last active
July 25, 2018 08:48
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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