aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-16 17:38:15 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-16 17:38:15 -0700
commit732b222126bd6b37925a4fcdcda832de65858122 (patch)
tree2cc78e4983f36dd2fe368558ca23bb80ecce80fd /lib/arel
parentb06d351b701906efab737894be674c66561ec524 (diff)
downloadrails-732b222126bd6b37925a4fcdcda832de65858122.tar.gz
rails-732b222126bd6b37925a4fcdcda832de65858122.tar.bz2
rails-732b222126bd6b37925a4fcdcda832de65858122.zip
fixed string escaping issue
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/extensions/object.rb2
-rw-r--r--lib/arel/relations/join.rb2
-rw-r--r--lib/arel/relations/relation.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/arel/extensions/object.rb b/lib/arel/extensions/object.rb
index 69ec6a5dce..0382ca8027 100644
--- a/lib/arel/extensions/object.rb
+++ b/lib/arel/extensions/object.rb
@@ -3,7 +3,7 @@ class Object
Arel::Value.new(self, relation)
end
- def to_sql(formatter = nil)
+ def to_sql(formatter)
formatter.scalar self
end
diff --git a/lib/arel/relations/join.rb b/lib/arel/relations/join.rb
index 2dd3555bac..8e29f0492b 100644
--- a/lib/arel/relations/join.rb
+++ b/lib/arel/relations/join.rb
@@ -25,7 +25,7 @@ module Arel
join_sql,
relation2.externalize.table_sql(formatter),
("ON" unless predicates.blank?),
- (predicates + relation2.externalize.selects).collect { |p| p.bind(environment).to_sql }.join(' AND ')
+ (predicates + relation2.externalize.selects).collect { |p| p.bind(environment).to_sql(Sql::WhereClause.new(environment)) }.join(' AND ')
].compact.join(" ")
[relation1.joins(environment), this_join, relation2.joins(environment)].compact.join(" ")
end
diff --git a/lib/arel/relations/relation.rb b/lib/arel/relations/relation.rb
index 490f545637..920bcd2d8d 100644
--- a/lib/arel/relations/relation.rb
+++ b/lib/arel/relations/relation.rb
@@ -9,8 +9,8 @@ module Arel
"SELECT #{attributes.collect { |a| a.to_sql(Sql::SelectClause.new(self)) }.join(', ')}",
"FROM #{table_sql(Sql::TableReference.new(self))}",
(joins(self) unless joins(self).blank? ),
- ("WHERE #{selects.collect { |s| s.to_sql(Sql::WhereClause.new(self)) }.join("\n\tAND ")}" unless selects.blank? ),
- ("ORDER BY #{orders.collect { |o| o.to_sql(Sql::OrderClause.new(self)) }.join(', ')}" unless orders.blank? ),
+ ("WHERE #{selects .collect { |s| s.to_sql(Sql::WhereClause.new(self)) }.join("\n\tAND ")}" unless selects.blank? ),
+ ("ORDER BY #{orders .collect { |o| o.to_sql(Sql::OrderClause.new(self)) }.join(', ')}" unless orders.blank? ),
("GROUP BY #{groupings.collect { |g| g.to_sql(Sql::GroupClause.new(self)) }.join(', ')}" unless groupings.blank? ),
("LIMIT #{taken}" unless taken.blank? ),
("OFFSET #{skipped}" unless skipped.blank? )