Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Aliased where to filter.

  • Loading branch information...
commit 1966cbaa1bcb0754d5baa8032c5a186112fc4acf 1 parent 42016ac
@jnunemaker jnunemaker authored
Showing with 10 additions and 0 deletions.
  1. +1 −0  lib/plucky/query.rb
  2. +9 −0 test/plucky/test_query.rb
View
1  lib/plucky/query.rb
@@ -147,6 +147,7 @@ def where(hash={})
query.criteria.merge!(CriteriaHash.new(hash))
end
end
+ alias filter where
def empty?
count.zero?
View
9 test/plucky/test_query.rb
@@ -559,6 +559,15 @@ class QueryTest < Test::Unit::TestCase
end
end
+ context "#filter" do
+ setup { @query = Query.new(@collection) }
+ subject { @query }
+
+ should "work the same as where" do
+ subject.filter(:age.lt => 29).filter(:name => 'Chris').all.should == [@chris]
+ end
+ end
+
context "#empty?" do
should "be true if empty" do
@collection.remove
Please sign in to comment.
Something went wrong with that request. Please try again.