Class: Parse::Constraint::RelationQueryConstraint
- Inherits:
-
Parse::Constraint
- Object
- Parse::Constraint
- Parse::Constraint::RelationQueryConstraint
- Defined in:
- lib/parse/query/constraints.rb
Overview
Equivalent to the ‘$relatedTo` Parse query operation. If you want to retrieve objects that are members of a `Relation` field in your Parse class.
q.where :field. => pointer
# find all Users who have liked this post object
post = Post.first
users = Parse::User.all :likes. => post
Instance Attribute Summary
Attributes inherited from Parse::Constraint
#operand, #operation, #operator, #value
Instance Method Summary collapse
-
#build ⇒ Hash
The compiled constraint.
-
#rel ⇒ RelationQueryConstraint
Alias for #related_to.
-
#related_to ⇒ RelationQueryConstraint
A registered method on a symbol to create the constraint.
Methods inherited from Parse::Constraint
#as_json, contraint_keyword, create, formatted_value, #formatted_value, #initialize, #key, #precedence, register, #to_s
Constructor Details
This class inherits a constructor from Parse::Constraint
Instance Method Details
#build ⇒ Hash
Returns the compiled constraint.
536 537 538 539 540 541 542 |
# File 'lib/parse/query/constraints.rb', line 536 def build # pointer = formatted_value # unless pointer.is_a?(Parse::Pointer) # raise "Invalid Parse::Pointer passed to :related(#{@operation.operand}) constraint : #{pointer}" # end { :$relatedTo => { object: formatted_value, key: @operation.operand } } end |
#rel ⇒ RelationQueryConstraint
Alias for #related_to
531 |
# File 'lib/parse/query/constraints.rb', line 531 contraint_keyword :$relatedTo |
#related_to ⇒ RelationQueryConstraint
A registered method on a symbol to create the constraint. Maps to Parse operator “$relatedTo”.
|
|
# File 'lib/parse/query/constraints.rb', line 522
|