Sha256: 8ae9159dd7d46f5892641002f7d843bfda08a2a3644b327862ec4ba9997ffb13

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

class Review < ActiveRecord::Base
  belongs_to :user
  belongs_to :product

  counter_culture :product
  counter_culture :product, :column_name => 'rexiews_count'
  counter_culture :user
  counter_culture :user, :column_name => Proc.new { |model| model.review_type ? "#{model.review_type}_count" : nil }, :column_names => {"reviews.review_type = 'using'" => 'using_count', "reviews.review_type = 'tried'" => 'tried_count'}
  counter_culture :user, :column_name => 'review_approvals_count', :delta_column => 'approvals'
  counter_culture :user, :column_name => 'review_value_sum', :delta_column => 'value'
  counter_culture [:user, :manages_company]
  counter_culture [:user, :manages_company], :column_name => 'review_approvals_count', :delta_column => 'approvals'
  counter_culture [:user, :manages_company, :industry]
  counter_culture [:user, :manages_company, :industry], :column_name => 'rexiews_count'
  counter_culture [:user, :manages_company, :industry], :column_name => Proc.new { |model| model.review_type ? "#{model.review_type}_count" : nil }
  counter_culture [:user, :manages_company, :industry], :column_name => 'review_approvals_count', :delta_column => 'approvals'

  after_create :update_some_text

  def update_some_text
    update_attribute(:some_text, rand(36**12).to_s(36))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
counter_culture-0.1.15 spec/models/review.rb