Browse files

fix up the comments to reflect the wheres and whys of module mixins a…

…s determined by various version dependencies.
  • Loading branch information...
1 parent 5897751 commit 727366f742af41ecac842a5edb28424647ec9668 Evan Dowling committed Apr 11, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/has_enumeration.rb
@@ -4,17 +4,21 @@
require 'has_enumeration/class_methods'
-# For ActiveRecord 3, extend Arel::Table, otherwise we'll need
-# our specialization of aggregate_conditions_override
+# We have two primary use cases, versions of ActiveRecord which define the column mapping in Arel,
+# and those which do not. For ActiveRecord 2.x.x and versions ActiveRecord which rely on
+# versions of Arel > 3.0.0, we have column mapping directly in ActiveRecord.
+# For the remaining cases, the method of determining column mappings is similar but not identical.
+# In general, Arel 2.x.x needs the mapping code described in HasEnumeration::Arel::TableExtensions,
+# whereas older versions of Arel need the code in HasEnumeration::Arel::TableExtensionsArelOne.
if ActiveRecord::VERSION::MAJOR >= 3
if Arel::VERSION >= "3.0.0"
require 'has_enumeration/aggregate_conditions_override'
elsif Arel::VERSION >= '2.0.0'
require 'has_enumeration/arel/table_extensions'
- ::Arel::Table.send(:include, HasEnumeration::Arel::TableExtensions)
+ Arel::Table.send(:include, HasEnumeration::Arel::TableExtensions)
require 'has_enumeration/arel/table_extensions_arel_one'
- ::Arel::Table.send(:include, HasEnumeration::Arel::TableExtensionsArelOne)
+ Arel::Table.send(:include, HasEnumeration::Arel::TableExtensionsArelOne)
require 'has_enumeration/aggregate_conditions_override'

0 comments on commit 727366f

Please sign in to comment.