Module: Deposit::AsDepositable

Extended by:
ActiveSupport::Concern
Defined in:
lib/deposit.rb

Instance Method Summary collapse

Instance Method Details

#load_deposit(key) ⇒ Object



27
28
29
30
31
# File 'lib/deposit.rb', line 27

def load_deposit key
  d = self.deposit_slots.where(key: key).first
  return nil unless d
  return d.data
end

#save_deposit(key, value) ⇒ Object



21
22
23
24
25
# File 'lib/deposit.rb', line 21

def save_deposit key, value
  d = self.deposit_slots.find_or_create_by_key key
  d.data = value
  d.save
end