Fix for incompatibility between Sequel and Arel in Rails 3.2.8. #135

Closed
wants to merge 2 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+15 −0
Split
@@ -474,6 +474,10 @@ def visit_Arel_Nodes_InfixOperation o
alias :visit_Arel_Nodes_Multiplication :visit_Arel_Nodes_InfixOperation
alias :visit_Arel_Nodes_Division :visit_Arel_Nodes_InfixOperation
+ def visit_Sequel_SQL_AliasedExpression o
+ "#{o.expression} AS #{o.aliaz}"
+ end
+
def visit_Array o
o.map { |x| visit x }.join(', ')
end
@@ -344,6 +344,17 @@ def quote value, column = nil
end
end
end
+
+ begin
+ require 'sequel'
+ it "should visit_Sequel_SQL_AliasedExpression if Sequel is present" do
+ [:to_sym, :to_s].each do |fn|
+ sql = @visitor.accept Sequel::SQL::AliasedExpression.new(*%w(foo bar).map(&fn))
+ sql.must_be_like "foo AS bar"
+ end
+ end
+ rescue LoadError
+ end
end
end
end