Class: IB::AccountValue
- Inherits:
-
Object
- Object
- IB::AccountValue
- Defined in:
- lib/models/ib/account_value.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#bake(account:, date: Date.today, via: IB::HAS_ACCOUNT) ⇒ Object
Assigns an AccountValue to the TimeGrid and inserts a link to the account to the AccountValueRecord.
Class Method Details
.bake(from:, with:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/models/ib/account_value.rb', line 12 def self.bake from:, with: user = HC::Users.where( account_id: with.is_a?(String) ? with : with.account ) &.first raise ArgumentError "No HC::Users record available" unless user.is_a? HC::Users time_graph_index = Date.today.to_tg # from.each do | account_value | new_ds = create values: {}, account: user, date: Date.today new_ds.values << from HC::AV.create from: time_graph_index, to: new_ds HC::MY_USER.create from: user, to: new_ds end |
Instance Method Details
#bake(account:, date: Date.today, via: IB::HAS_ACCOUNT) ⇒ Object
Assigns an AccountValue to the TimeGrid and inserts a link to the account to the AccountValueRecord
5 6 7 8 |
# File 'lib/models/ib/account_value.rb', line 5 def bake account:, date: Date.today, via: IB::HAS_ACCOUNT self.attributes[:account]= account.rid date.to_tg.assign vertex = self, via: via end |