Class: Og::BelongsTo

Inherits:
RefersTo show all
Defined in:
lib/og/relation/belongs_to.rb

Instance Attribute Summary

Attributes inherited from Relation

#options

Instance Method Summary collapse

Methods inherited from RefersTo

foreign_key

Methods inherited from Relation

#[], #[]=, enchant, #initialize, #method_missing, #polymorphic?, #polymorphic_marker?, resolve, resolve_names, #resolve_polymorphic, resolve_polymorphic_markers, resolve_polymorphic_relations, resolve_targets, symbol_to_class, #to_s

Constructor Details

This class inherits a constructor from Og::Relation

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Og::Relation

Instance Method Details

#enchantObject



7
8
9
10
11
12
13
# File 'lib/og/relation/belongs_to.rb', line 7

def enchant
  super
  unless target_class.ann.self[:descendants]
    target_class.ann(:self, :descendants => [])
  end
  target_class.ann.self.descendants! << [owner_class, foreign_key]
end