lib/plucky/query.rb in plucky-0.3.0 vs lib/plucky/query.rb in plucky-0.3.1

- old
+ new

@@ -11,11 +11,11 @@ ] attr_reader :criteria, :options, :collection def_delegator :criteria, :simple? def_delegator :options, :fields? - def_delegators :to_a, :each + def_delegators :to_a, :each, :include? def initialize(collection, opts={}) @collection, @options, @criteria = collection, OptionsHash.new, CriteriaHash.new opts.each { |key, value| self[key] = value } end @@ -132,9 +132,14 @@ end def empty? count.zero? end + + def exists?(options={}) + !count(options).zero? + end + alias :exist? :exists? def to_a all end \ No newline at end of file