Module: Engrel::Helpers::AciveRecordInstanceMethods

Defined in:
lib/engrel.rb

Instance Method Summary collapse

Instance Method Details

#fact(verb, direct_object, &block) ⇒ Object Also known as: claim

Helper method that gets included into AR::Base that allows any model object to specify a relationship between it and any other object (the direct object (they’re both polymorphic, of course).

Parameters:

  • The (Symbol)

    downcased, underscored word representing the transitive verb i.e. (:is_friends_with)

  • The (Object)

    direct object that is the second receiver for the trasitive verb above.



33
34
35
# File 'lib/engrel.rb', line 33

def fact(verb, direct_object, &block)
  Engrel::Sentence.claim(self, verb, direct_object, &block)
end