Module: BananaSplit::Controller::InstanceMethods

Defined in:
lib/banana_split/controller.rb

Instance Method Summary collapse

Instance Method Details

#ab_goal(test_name, value = 1) ⇒ Object



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

def ab_goal(test_name, value = 1)
  test = AbTest.find_by_name(test_name)
  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



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

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