parsecom 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/parse/object.rb +10 -0
- data/lib/parse/version.rb +1 -1
- data/lib/parsecom.rb +0 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -350,7 +350,7 @@ game_scores = GameScore.find :where => proc {
|
|
350
350
|
#### Counting Objects
|
351
351
|
|
352
352
|
```ruby
|
353
|
-
game_scores = GameScore.
|
353
|
+
game_scores = GameScore.count 'playerName' => 'Jonathan Walsh'
|
354
354
|
game_scores.query_count
|
355
355
|
```
|
356
356
|
|
data/lib/parse/object.rb
CHANGED
@@ -77,6 +77,16 @@ module Parse
|
|
77
77
|
def find_all! opts={}
|
78
78
|
find! :all, opts
|
79
79
|
end
|
80
|
+
|
81
|
+
def count condition=nil, &block
|
82
|
+
opts = {:limit => 0, :count => true}
|
83
|
+
if condition
|
84
|
+
opts[:where] = condition
|
85
|
+
elsif block
|
86
|
+
opts[:where] = block
|
87
|
+
end
|
88
|
+
find(:all, opts).query_count
|
89
|
+
end
|
80
90
|
end
|
81
91
|
|
82
92
|
attr_accessor :parse_object_id, :created_at, :updated_at, :acl
|
data/lib/parse/version.rb
CHANGED
data/lib/parsecom.rb
CHANGED