split: undefined method `ab_test' for #<#:0x007fcc0e5f8de0>

If I call ab_test in a view I get the exception mentioned.

Including Split::Helper in my ApplicationHelper will solve this, but not sure of the cause.

I’m presuming it’s something to do with load order of Split and the if defined? Rails not getting executed, but can’t seem to get to the bottom of it, so no failing test case at the moment.

Have you encountered this before?

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 29 (14 by maintainers)

Most upvoted comments

I have the same issue. Though it is strange it started occurring after using the ab_test method with 4 arguments (name, version_1_hash, version_2_hash, version_3_hash). If I change it back to 3 and then to 4 then it works but only until the next server restart.

config.include_rails_helper = true didn’t work for me

include Split::Helper in application_helper.rb worked.

@swrobel I worked around the issue by just adding:

include Split::Helper

to my initializers/split.rb file as @gingerlime suggested.

We’ve had a similar problem with our Rails 3.2 app.

Eventually what seemed to solve it for us was doing this:

Gemfile:

...
gem 'split'

config/initializers/split.rb:

require 'split/dashboard'
include Split::Helper