Module: ParseResource::QueryMethods::ClassMethods
- Defined in:
- lib/parse_resource/query_methods.rb
Instance Method Summary collapse
-
#all ⇒ Array
Find all ParseResource::Base objects for that model.
-
#count ⇒ Object
Add this at the end of a method chain to get the count of objects, instead of an Array of objects.
-
#first ⇒ Object
Find the first object.
-
#include_object(parent) ⇒ Object
Include the attributes of a parent ojbect in the results Similar to ActiveRecord eager loading.
-
#limit(n) ⇒ Object
Limits the number of objects returned.
- #near(near, geo_point, options = {}) ⇒ Object
- #order(attr) ⇒ Object
-
#skip(n) ⇒ Object
Skip the number of objects.
- #within_box(near, geo_point_south, geo_point_north) ⇒ Object
Instance Method Details
#all ⇒ Array
Find all ParseResource::Base objects for that model.
25 26 27 |
# File 'lib/parse_resource/query_methods.rb', line 25 def all Query.new(self).all end |
#count ⇒ Object
Add this at the end of a method chain to get the count of objects, instead of an Array of objects
17 18 19 20 |
# File 'lib/parse_resource/query_methods.rb', line 17 def count #https://www.parse.com/docs/rest#queries-counting Query.new(self).count(1) end |
#first ⇒ Object
Find the first object. Fairly random, not based on any specific condition.
31 32 33 |
# File 'lib/parse_resource/query_methods.rb', line 31 def first Query.new(self).limit(1).first end |
#include_object(parent) ⇒ Object
Include the attributes of a parent ojbect in the results Similar to ActiveRecord eager loading
12 13 14 |
# File 'lib/parse_resource/query_methods.rb', line 12 def include_object(parent) Query.new(self).include_object(parent) end |
#limit(n) ⇒ Object
Limits the number of objects returned
37 38 39 |
# File 'lib/parse_resource/query_methods.rb', line 37 def limit(n) Query.new(self).limit(n) end |
#near(near, geo_point, options = {}) ⇒ Object
51 52 53 |
# File 'lib/parse_resource/query_methods.rb', line 51 def near(near, geo_point, ={}) Query.new(self).near(near, geo_point, ) end |
#order(attr) ⇒ Object
47 48 49 |
# File 'lib/parse_resource/query_methods.rb', line 47 def order(attr) Query.new(self).order(attr) end |
#skip(n) ⇒ Object
Skip the number of objects
43 44 45 |
# File 'lib/parse_resource/query_methods.rb', line 43 def skip(n) Query.new(self).skip(n) end |
#within_box(near, geo_point_south, geo_point_north) ⇒ Object
55 56 57 |
# File 'lib/parse_resource/query_methods.rb', line 55 def within_box(near, geo_point_south, geo_point_north) Query.new(self).within_box(near, geo_point_south, geo_point_north) end |