This project is archived and is in readonly mode.
ARel 1.9.2 compatibility
Reported by Nikolai Lugovoi | October 15th, 2009 @ 09:36 PM | in 3.0.2
- Array#to_s in 1.9.2 changed to more :inspect-like,
--- a/lib/arel/engines/sql/relations/relation.rb
+++ b/lib/arel/engines/sql/relations/relation.rb
@@ -12,7 +12,7 @@
order = order.zip((0...order.size).to_a).map { |s,i| "id_list.alias_#{i} #{'DESC' if s =~ /\bdesc$/i}" }.join(', ')
query = build_query \
- "SELECT #{select_clauses.to_s}",
+ "SELECT #{select_clauses.kind_of?(::Array) ? select_clauses.join("") : select_clauses.to_s}",
"FROM #{table_sql(Sql::TableReference.new(self))}",
(joins(self) unless joins(self).blank? ),
("WHERE #{where_clauses.join("\n\tAND ")}" unless wheres.blank? ),
- Some methods aren't delegated, as instance_methods() returns array of symbols:
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -110,7 +110,7 @@ module ActiveRecord
end
def respond_to?(method)
- if @relation.respond_to?(method) || Array.instance_methods.include?(method.to_s)
+ if @relation.respond_to?(method) || [].respond_to?(method)
true
else
super
@@ -121,7 +121,7 @@ module ActiveRecord
def method_missing(method, *args, &block)
if @relation.respond_to?(method)
@relation.send(method, *args, &block)
- elsif Array.instance_methods.include?(method.to_s)
+ elsif [].respond_to?(method)
to_a.send(method, *args, &block)
end
end
Comments and changes to this ticket
-
Jeremy Kemper November 10th, 2009 @ 01:18 PM
- State changed from new to open
- Milestone cleared.
-
Jeremy Kemper November 10th, 2009 @ 08:00 PM
- State changed from open to resolved
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>