Permalink
Browse files

avoid Symbol#to_proc

  • Loading branch information...
1 parent b6cf638 commit f78a4e88f668028d1ee8163b7d9756553f15d914 @vijaydev vijaydev committed Jul 19, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/finder_methods.rb
@@ -243,7 +243,7 @@ def apply_join_dependency(relation, join_dependency)
end
def construct_limited_ids_condition(relation)
- orders = relation.order_values.map(&:presence).compact
+ orders = relation.order_values.map { |val| val.presence }.compact
values = @klass.connection.distinct("#{@klass.connection.quote_table_name table_name}.#{primary_key}", orders)
relation = relation.dup

3 comments on commit f78a4e8

Contributor

dontangg replied Jul 19, 2011

I'm curious to learn why you want to avoid Symbol#to_proc. Everywhere that I read about Symbol#to_proc it is praised. Is it slower? Are there use cases where it is still a good idea? Is there some blog post that explains why/when to avoid this?

Member

vijaydev replied Jul 19, 2011

Apparently it's slower in 1.8.7. See 0e1d617#commitcomment-484668

Owner

fxn replied Jul 19, 2011

When support for 1.8 is dropped (possibly in Rails 4), then we could undo all those changes.

Please sign in to comment.