aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/nodes/binary.rb10
-rw-r--r--lib/arel/nodes/function.rb7
-rw-r--r--lib/arel/nodes/grouping.rb10
-rw-r--r--lib/arel/nodes/node.rb10
4 files changed, 11 insertions, 26 deletions
diff --git a/lib/arel/nodes/binary.rb b/lib/arel/nodes/binary.rb
index 090468adfa..cfa75909c5 100644
--- a/lib/arel/nodes/binary.rb
+++ b/lib/arel/nodes/binary.rb
@@ -7,16 +7,6 @@ module Arel
@left = left
@right = right
end
-
- # FIXME: this method should go away. I don't like people calling
- # to_sql on non-head nodes. This forces us to walk the AST until we
- # can find a node that has a "relation" member.
- #
- # Maybe we should just use `Table.engine`? :'(
- def to_sql
- viz = Visitors::ToSql.new Table.engine
- viz.accept self
- end
end
end
end
diff --git a/lib/arel/nodes/function.rb b/lib/arel/nodes/function.rb
index a1cd13d4d1..133dd66019 100644
--- a/lib/arel/nodes/function.rb
+++ b/lib/arel/nodes/function.rb
@@ -1,6 +1,6 @@
module Arel
module Nodes
- class Function
+ class Function < Arel::Nodes::Node
include Arel::Expression
attr_accessor :expressions, :alias
@@ -13,11 +13,6 @@ module Arel
self.alias = SqlLiteral.new(aliaz)
self
end
-
- def to_sql
- viz = Visitors::ToSql.new Table.engine
- viz.accept self
- end
end
end
end
diff --git a/lib/arel/nodes/grouping.rb b/lib/arel/nodes/grouping.rb
index 0af1df1f7a..d52671f169 100644
--- a/lib/arel/nodes/grouping.rb
+++ b/lib/arel/nodes/grouping.rb
@@ -6,16 +6,6 @@ module Arel
def initialize expression
@expr = expression
end
-
- # FIXME: this method should go away. I don't like people calling
- # to_sql on non-head nodes. This forces us to walk the AST until we
- # can find a node that has a "relation" member.
- #
- # Maybe we should just use `Table.engine`? :'(
- def to_sql
- viz = Visitors::ToSql.new Table.engine
- viz.accept self
- end
end
end
end
diff --git a/lib/arel/nodes/node.rb b/lib/arel/nodes/node.rb
index fd5ea410ea..91c0a32573 100644
--- a/lib/arel/nodes/node.rb
+++ b/lib/arel/nodes/node.rb
@@ -15,6 +15,16 @@ module Arel
def and right
Nodes::And.new self, right
end
+
+ # FIXME: this method should go away. I don't like people calling
+ # to_sql on non-head nodes. This forces us to walk the AST until we
+ # can find a node that has a "relation" member.
+ #
+ # Maybe we should just use `Table.engine`? :'(
+ def to_sql engine = Table.engine
+ viz = Visitors::ToSql.new engine
+ viz.accept self
+ end
end
end
end