Created
November 29, 2019 15:46
-
-
Save tbuyle/c6cf3dfdf7fb5c4da0a56452dcb67559 to your computer and use it in GitHub Desktop.
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
def self.multi_scope(scopes) | |
my_scopes = Array.new | |
scopes.each do |scope| | |
m_scopes << self.send(scope) if self.respond_to? scope | |
end | |
if my_scopes.length == 0 | |
return slef.none | |
else | |
f = my_scopes.delete_at(0) | |
my_scopes.each do |s| | |
f = f.or(s) | |
end | |
return f | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment