A/B split testing in rails?

What’s the best practice around setting up an A/B split test in
rails? Initially, I’d like to test the effectiveness of different
view elements, but ultimately would like to also split test business
logic, so the split test framework should extend to the controllers
and perhaps models.

Ideally, this functionality would be encapsulated into some kind of
plug-in, so that it can be reused easily and facilitate easy creation
of tests and reporting. I couldn’t find any plug-ins that facilitate
this, however.

Has anyone gone down this road before? Any thoughts on the best way
to structure a split testing framework so that it’s easily re-usable,
and without littering one’s code with a bunch of case statements?

Thanks!