Module: Rea::MetaType::Event::EventClassMethods
- Defined in:
- lib/rea/meta_type/event.rb
Instance Method Summary collapse
Instance Method Details
#create_event(commitment) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rea/meta_type/event.rb', line 12 def create_event commitment amount = (commitment.fulfilled?) ? commitment.amount : -commitment.amount = {:resource_id=>commitment.resource_id, :amount=>amount} .merge!( if commitment.respond_to?(:provider) {:provider_id=>commitment.provider_id} else {:recipient_id=>commitment.recipient_id} end ) self.create! end |