Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

avoid Symbol#to_proc

  • Loading branch information...
commit f78a4e88f668028d1ee8163b7d9756553f15d914 1 parent b6cf638
@vijaydev vijaydev authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activerecord/lib/active_record/relation/finder_methods.rb
View
2  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

@dontangg

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?

@vijaydev
Collaborator

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

@fxn
Owner

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

Please sign in to comment.
Something went wrong with that request. Please try again.