diff options
Diffstat (limited to 'activerecord/lib/arel.rb')
-rw-r--r-- | activerecord/lib/arel.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/arel.rb b/activerecord/lib/arel.rb index dab785738e..0fc07e1ede 100644 --- a/activerecord/lib/arel.rb +++ b/activerecord/lib/arel.rb @@ -12,8 +12,7 @@ require "arel/math" require "arel/alias_predication" require "arel/order_predications" require "arel/table" -require "arel/attributes" -require "arel/compatibility/wheres" +require "arel/attributes/attribute" require "arel/visitors" require "arel/collectors/sql_string" @@ -40,6 +39,13 @@ module Arel # :nodoc: all value.is_a?(Arel::Node) || value.is_a?(Arel::Attribute) || value.is_a?(Arel::Nodes::SqlLiteral) end + def self.fetch_attribute(value) + case value + when Arel::Nodes::Between, Arel::Nodes::In, Arel::Nodes::NotIn, Arel::Nodes::Equality, Arel::Nodes::NotEqual, Arel::Nodes::LessThan, Arel::Nodes::LessThanOrEqual, Arel::Nodes::GreaterThan, Arel::Nodes::GreaterThanOrEqual + yield value.left.is_a?(Arel::Attributes::Attribute) ? value.left : value.right + end + end + ## Convenience Alias Node = Arel::Nodes::Node end |