diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-12-31 09:59:38 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-12-31 09:59:38 -0300 |
commit | 5f23dad4e5b14e14f09068c1993d8cc0c0780ad8 (patch) | |
tree | ff7fb92ee31a11aba81dcff840369e9114833ecd | |
parent | 818f019711d448a62ee11569f5ca1ba0ddfb3c2c (diff) | |
download | rails-5f23dad4e5b14e14f09068c1993d8cc0c0780ad8.tar.gz rails-5f23dad4e5b14e14f09068c1993d8cc0c0780ad8.tar.bz2 rails-5f23dad4e5b14e14f09068c1993d8cc0c0780ad8.zip |
Remove every new line when generating queries, this may build invalid queries on SQLite.
-rw-r--r-- | lib/arel/engines/sql/relations/relation.rb | 4 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations/writes.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/arel/engines/sql/relations/relation.rb b/lib/arel/engines/sql/relations/relation.rb index 940f985358..78508595fd 100644 --- a/lib/arel/engines/sql/relations/relation.rb +++ b/lib/arel/engines/sql/relations/relation.rb @@ -15,7 +15,7 @@ module Arel "SELECT #{select_clauses.kind_of?(::Array) ? select_clauses.join("") : select_clauses.to_s}", "FROM #{from_clauses}", (joins(self) unless joins(self).blank? ), - ("WHERE #{where_clauses.join("\n\tAND ")}" unless wheres.blank? ), + ("WHERE #{where_clauses.join(" AND ")}" unless wheres.blank? ), ("GROUP BY #{group_clauses.join(', ')}" unless groupings.blank? ), ("HAVING #{having_clauses.join(', ')}" unless havings.blank? ), ("#{locked}" unless locked.blank? ) @@ -31,7 +31,7 @@ module Arel "SELECT #{select_clauses.join(', ')}", "FROM #{from_clauses}", (joins(self) unless joins(self).blank? ), - ("WHERE #{where_clauses.join("\n\tAND ")}" unless wheres.blank? ), + ("WHERE #{where_clauses.join(" AND ")}" unless wheres.blank? ), ("GROUP BY #{group_clauses.join(', ')}" unless groupings.blank? ), ("HAVING #{having_clauses.join(', ')}" unless havings.blank? ), ("ORDER BY #{order_clauses.join(', ')}" unless orders.blank? ), diff --git a/lib/arel/engines/sql/relations/writes.rb b/lib/arel/engines/sql/relations/writes.rb index 50fcb8e07e..83c5fbad42 100644 --- a/lib/arel/engines/sql/relations/writes.rb +++ b/lib/arel/engines/sql/relations/writes.rb @@ -4,7 +4,7 @@ module Arel build_query \ "DELETE", "FROM #{table_sql}", - ("WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ), + ("WHERE #{wheres.collect(&:to_sql).join(' AND ')}" unless wheres.blank? ), ("LIMIT #{taken}" unless taken.blank? ) end end @@ -55,7 +55,7 @@ module Arel attributes.map do |attribute| value = assignments[attribute] "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}" - end.join(",\n") + end.join(", ") else assignments.value end @@ -63,7 +63,7 @@ module Arel def build_update_conditions_sql conditions = "" - conditions << " WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank? + conditions << " WHERE #{wheres.collect(&:to_sql).join(' AND ')}" unless wheres.blank? conditions << " ORDER BY #{order_clauses.join(', ')}" unless orders.blank? unless taken.blank? |