Class: Vanity::Adapters::ActiveRecordAdapter::VanityExperiment

Inherits:
VanityRecord
  • Object
show all
Defined in:
lib/vanity/adapters/active_record_adapter.rb

Overview

Experiment model

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VanityRecord

define_schema

Class Method Details

.retrieve(experiment) ⇒ Object

Finds or creates the experiment



99
100
101
# File 'lib/vanity/adapters/active_record_adapter.rb', line 99

def self.retrieve(experiment)
  find_or_create_by_experiment_id(experiment.to_s)
end

Instance Method Details

#increment_conversion(alternative, count = 1) ⇒ Object



103
104
105
106
# File 'lib/vanity/adapters/active_record_adapter.rb', line 103

def increment_conversion(alternative, count = 1)
  record = vanity_conversions.find_or_create_by_alternative(alternative)
  record.increment!(:conversions, count)
end