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
# class to construct conditions for AR queries | |
# cc = ConditionsConstructor.new('foobar > ?', 7) | |
# cc.add('blah is not null') | |
# cc.add('baz in (?)', [1,2,3]) | |
# cc.conditions | |
# # => ["(foobar > ?) AND (blah is not null) AND (baz in (?))", 7, [1, 2, 3]] | |
class ConditionsConstructor | |
def initialize(*args) | |
add *args unless args.blank? | |
end |
NewerOlder