Sha256: 92aec3ae62d19f984ef53154d33c39b14fc8dbda6fec4ae554cbfbb646d757a2
Contents?: true
Size: 493 Bytes
Versions: 28
Compression:
Stored size: 493 Bytes
Contents
class MetricVariant < ActiveRecord::Base belongs_to :metric validates_presence_of :name validates_presence_of :metric_id def tally_serve(count = 1) MetricVariant.update_counters(self.id, :served => count) self.reload end def tally_convert(count = 1) MetricVariant.update_counters(self.id, :conversions => count) self.reload end def conversion_rate return nil if self.served == 0 return self.conversions / self.served.to_f * 100 end end
Version data entries
28 entries across 28 versions & 1 rubygems