Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add some convenient methods for avoiding array allocations

  • Loading branch information...
commit 0cfb1de4583b5926bbb10de39d80d8537a7e6482 1 parent 752a06e
Aaron Patterson tenderlove authored
6 activerecord/lib/active_record/associations/join_dependency.rb
View
@@ -76,17 +76,17 @@ def graft(*associations)
end
def reflections
- join_root.drop(1).map(&:reflection)
+ join_root.drop(1).map!(&:reflection)
end
def join_relation(relation)
- join_root.drop(1).inject(relation) do |rel,association|
+ join_root.inject(relation) do |rel,association|
association.join_relation(rel)
end
end
def join_constraints
- join_root.drop(1).flat_map(&:join_constraints)
+ join_root.flat_map(&:join_constraints)
end
def columns
3  activerecord/lib/active_record/associations/join_dependency/join_part.rb
View
@@ -29,6 +29,9 @@ def initialize(base_klass, parent)
@children = []
end
+ def join_constraints; []; end
+ def join_relation(rel); rel; end
+
def name
reflection.name
end
Please sign in to comment.
Something went wrong with that request. Please try again.