Module: BananaSplit::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/banana_split/controller.rb

Instance Method Summary collapse

Instance Method Details

#ab_goal(test_name, value = 1) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/banana_split/controller.rb', line 9

def ab_goal(test_name, value = 1)
  test = AbTest.find_by_name(test_name)
  return if test.blank?
  test_run = AbTestRun.find_by_session_id_and_ab_test_id(session_id, test.id)
  if test_run && test_run.value == 0
    test_run.update_attribute(:value, value)
  end
end

#session_idObject



18
19
20
21
# File 'lib/banana_split/controller.rb', line 18

def session_id
  banana_init_session if request.session_options[:id].blank?
  request.session_options[:id]
end