Octopus is still the one to pick, despite that issue. We use it at Square for the use case you describe.
Commits to relax the dependency went in directly after v0.4.0, so it's safe to lock to a git revision:
gem 'octopus',
:git => 'https://github.com/tchandy/octopus.git',
:ref => '7e585ecd35d3caf9b5d23a0265e709716740a3ce'
Other changes in master look mostly 3.1 and spec related, plus a single performance commit (my commit), so it's probably fine also.
For reference, we're running a fork of v0.4.0 amended to allow AR 2.3, plus a performance related commit which is now on master (not critical if you're not doing heaps of traffic, but nice.)
git diff v0.4.0..7e585ecd35d3caf9b5d23a0265e709716740a3ce
diff --git a/Gemfile b/Gemfile
index e82375d..c3bcf77 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
source :rubygems
-gem 'activerecord', '3.0.6'
-gem 'actionpack', '3.0.6'
+gem 'activerecord', '~> 3.0'
+gem 'actionpack', '~> 3.0'
group :test do
gem "rake", ">= 0.8.7"
diff --git a/Gemfile.lock b/Gemfile.lock
index a80476c..a82c18f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -58,8 +58,8 @@ PLATFORMS
ruby
DEPENDENCIES
- actionpack (= 3.0.6)
- activerecord (= 3.0.6)
+ actionpack (~> 3.0)
+ activerecord (~> 3.0)
jeweler (>= 1.4)
mysql2
pg (>= 0.9.0)
diff --git a/ar-octopus.gemspec b/ar-octopus.gemspec
index 9e5f73e..2b06df4 100644
--- a/ar-octopus.gemspec
+++ b/ar-octopus.gemspec
@@ -171,8 +171,8 @@ Gem::Specification.new do |s|
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activerecord>, ["= 3.0.6"])
- s.add_runtime_dependency(%q<actionpack>, ["= 3.0.6"])
+ s.add_runtime_dependency(%q<activerecord>, ["~> 3.0"])
+ s.add_runtime_dependency(%q<actionpack>, ["~> 3.0"])
s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
s.add_development_dependency(%q<mysql2>, [">= 0"])
s.add_development_dependency(%q<pg>, [">= 0.9.0"])
@@ -181,8 +181,8 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<actionpack>, [">= 2.3"])
s.add_runtime_dependency(%q<activerecord>, [">= 2.3"])
else
- s.add_dependency(%q<activerecord>, ["= 3.0.6"])
- s.add_dependency(%q<actionpack>, ["= 3.0.6"])
+ s.add_dependency(%q<activerecord>, ["~> 3.0"])
+ s.add_dependency(%q<actionpack>, ["~> 3.0"])
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
s.add_dependency(%q<mysql2>, [">= 0"])
s.add_dependency(%q<pg>, [">= 0.9.0"])
@@ -192,8 +192,8 @@ Gem::Specification.new do |s|
s.add_dependency(%q<activerecord>, [">= 2.3"])
end
else
- s.add_dependency(%q<activerecord>, ["= 3.0.6"])
- s.add_dependency(%q<actionpack>, ["= 3.0.6"])
+ s.add_dependency(%q<activerecord>, ["~> 3.0"])
+ s.add_dependency(%q<actionpack>, ["~> 3.0"])
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.19"])
s.add_dependency(%q<mysql2>, [">= 0"])
s.add_dependency(%q<pg>, [">= 0.9.0"])
diff --git a/lib/octopus/association_collection.rb b/lib/octopus/association_collection.rb
index 2dbff87..44d0f7a 100644
--- a/lib/octopus/association_collection.rb
+++ b/lib/octopus/association_collection.rb
@@ -12,4 +12,8 @@ module Octopus::AssociationCollection
end
end
-ActiveRecord::Associations::AssociationCollection.send(:include, Octopus::AssociationCollection)
\ No newline at end of file
+if ActiveRecord::VERSION::MAJOR >= 3 && ActiveRecord::VERSION::MINOR >=1
+ ActiveRecord::Associations::CollectionAssociation.send(:include, Octopus::AssociationCollection)
+else
+ ActiveRecord::Associations::AssociationCollection.send(:include, Octopus::AssociationCollection)
+end
diff --git a/lib/octopus/migration.rb b/lib/octopus/migration.rb
index 70bd8bd..7d9fd90 100644
--- a/lib/octopus/migration.rb
+++ b/lib/octopus/migration.rb
@@ -70,4 +70,8 @@ module Octopus::Migration
end
end
-ActiveRecord::Migration.extend(Octopus::Migration)
+if ActiveRecord::VERSION::MAJOR >= 3 && ActiveRecord::VERSION::MINOR >=1
+ ActiveRecord::Migration.send :include, Octopus::Migration
+else
+ ActiveRecord::Migration.extend(Octopus::Migration)
+end
```