Module: IWonder::AbTesting::ActionControllerMixins

Defined in:
lib/i_wonder/ab_testing/action_controller_mixins.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
# File 'lib/i_wonder/ab_testing/action_controller_mixins.rb', line 5

def self.included(base)
  base.class_eval do
    helper_method :which_test_group?
  end
end

Instance Method Details

#which_test_group?(event_sym) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
# File 'lib/i_wonder/ab_testing/action_controller_mixins.rb', line 11

def which_test_group?(event_sym)
  ab_test = IWonder::AbTest.find_by_sym(event_sym.to_s)
  return false unless ab_test

  if params[:_force_ab_test] and params[:_to_option] and params[:_force_ab_test]==event_sym.to_s
    return params[:_to_option]
  end
  
  ab_test.which_test_group?(self)
end