From 6928950def1bea9d564778e734822d4f5b8bac61 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Wed, 24 Jan 2018 14:06:30 -0500 Subject: Avoid passing unnecessary arguments to relation Most of the time the table and predicate_builder passed to Relation.new are exactly the arel_table and predicate builder of the given klass. This uses klass.arel_table and klass.predicate_builder as the defaults, so we don't have to pass them in most cases. This does change the signaure of both Relation and AssocationRelation. Are we ok with that? --- activerecord/test/models/post.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index b552f66787..54eb5e6783 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -326,5 +326,13 @@ class FakeKlass def enforce_raw_sql_whitelist(*args) # noop end + + def arel_table + Post.arel_table + end + + def predicate_builder + Post.predicate_builder + end end end -- cgit v1.2.3