From e32df2af49dc05a7e56357fd7f19bd1a9d3aea5d Mon Sep 17 00:00:00 2001 From: Brandon Carpenter Date: Wed, 8 May 2013 16:16:35 -0400 Subject: [PATCH 1/2] Rails 2.3.x compatibility patch. Rails 2.3 doesn't have Engine support, so disable that and let people add the helpers themselves via an initializer. Based on @RyanNaughton's comments here: https://github.com/andrew/split/issues/95 --- lib/split.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/split.rb b/lib/split.rb index 36ea91e1..2aa88a42 100755 --- a/lib/split.rb +++ b/lib/split.rb @@ -2,7 +2,7 @@ require "split/#{f}" end -require 'split/engine' if defined?(Rails) +require 'split/engine' if defined?(Rails) && Rails::VERSION::MAJOR >= 3 require 'redis/namespace' module Split From 6bf773f225417a521569d128dedbeea1cdb32f50 Mon Sep 17 00:00:00 2001 From: Brandon Carpenter Date: Wed, 8 May 2013 16:26:41 -0400 Subject: [PATCH 2/2] Add Rails 2.3 initialization steps to the README. --- README.mdown | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.mdown b/README.mdown index f20437d0..30ddb59a 100644 --- a/README.mdown +++ b/README.mdown @@ -62,10 +62,19 @@ Put the following in your gemfile as well: gem 'SystemTimer' ``` -### Rails +### Rails 3 Split is autoloaded when rails starts up, as long as you've configured redis it will 'just work'. +### Rails 2.3 + +To configure Rails 2.3 with Split you need to mix in the helper methods. Add the following lines to config/initializers.split.rb: + +```ruby +ActionController::Base.send :include, Split::Helper +ActionController::Base.helper Split::Helper +``` + ### Sinatra To configure sinatra with Split you need to enable sessions and mix in the helper methods. Add the following lines at the top of your sinatra app: