Sha256: 19fbc9e0ffe39ba93fad93c5eb941aaad9a1c1adf444c660a043ffeb01fb7603

Contents?: true

Size: 189 Bytes

Versions: 6

Compression:

Stored size: 189 Bytes

Contents

# frozen_string_literal: true

class Invoice < ActiveRecord::Base
  has_many :line_items, autosave: true
  before_save { |record| record.balance = record.line_items.map(&:amount).sum }
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ibm_db-5.5.0 test/models/invoice.rb
ibm_db-5.4.1 test/models/invoice.rb
ibm_db-5.4.0 test/models/invoice.rb
ibm_db-5.3.2 test/models/invoice.rb
ibm_db-5.3.1 test/models/invoice.rb
ruby-on-quails-0.1.0 activerecord/test/models/invoice.rb