Class: ActsAsHoldable::Holding

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/acts_as_holdable/holding.rb

Overview

Holding model. Store in host database holdings made by holders on holdables

Instance Method Summary collapse

Instance Method Details

#on_hold_required?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/acts_as_holdable/holding.rb', line 27

def on_hold_required?
  holdable.holding_opts && holdable.holding_opts[:on_hold_track] != false
end

#update_on_holdObject



22
23
24
25
# File 'lib/acts_as_holdable/holding.rb', line 22

def update_on_hold
  holdable.update(on_hold: holdable.holdings.sum(:amount)) if holdable.respond_to?(:on_hold)
  holdable.reload
end