Sha256: b8fcaca33ef94d446ad39e7178815284299416b31d11a6b68fa584e1d23eb8ba

Contents?: true

Size: 455 Bytes

Versions: 31

Compression:

Stored size: 455 Bytes

Contents

class Transaction < ActiveRecord::Base
  belongs_to :person

  counter_culture [:person],
    :column_name => proc {|model| model.earns_money? ? 'money_earned_total' : 'money_spent_total' },
    :column_names => {
          ["transactions.monetary_value > 0"] => 'money_earned_total',
          ["transactions.monetary_value <= 0"] => 'money_spent_total'
      },
    :delta_column => 'monetary_value'

  def earns_money?
    monetary_value > 0
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
counter_culture-2.2.2 spec/models/transaction.rb
counter_culture-2.2.1 spec/models/transaction.rb
counter_culture-2.2.0 spec/models/transaction.rb
counter_culture-2.1.4 spec/models/transaction.rb
counter_culture-2.1.3 spec/models/transaction.rb
counter_culture-2.1.2 spec/models/transaction.rb
counter_culture-2.1.1 spec/models/transaction.rb
counter_culture-2.1.0 spec/models/transaction.rb
counter_culture-2.0.1 spec/models/transaction.rb
counter_culture-2.0.0 spec/models/transaction.rb
counter_culture-1.12.0 spec/models/transaction.rb
counter_culture-1.11.0 spec/models/transaction.rb
counter_culture-1.10.0 spec/models/transaction.rb
counter_culture-1.9.2 spec/models/transaction.rb
counter_culture-1.9.1 spec/models/transaction.rb
counter_culture-1.9.0 spec/models/transaction.rb
counter_culture-1.8.2 spec/models/transaction.rb
counter_culture-1.8.1 spec/models/transaction.rb
counter_culture-1.8.0 spec/models/transaction.rb
counter_culture-1.7.0 spec/models/transaction.rb