Class: Parse::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/relation.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, column_name, hash) ⇒ Relation

Returns a new instance of Relation.



4
5
6
7
8
# File 'lib/parse/relation.rb', line 4

def initialize parent, column_name, hash
  @parent_object = parent
  @column_name = column_name
  @raw_hash = hash
end

Instance Method Details

#load(parse_client = Parse::Client.default) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/parse/relation.rb', line 10

def load parse_client=Parse::Client.default
  unless @objects
    pointer = @parent_object.pointer
    key = @column_name
    related_class = Parse::Object @raw_hash['className']
    @objects = related_class.find :where => proc {
      related_to key, pointer
    }
  end
  @objects
end