aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/base.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index b23ce53d43..3bbe23865f 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1533,9 +1533,12 @@ module ActiveRecord #:nodoc:
end
- def arel_table(table = nil)
+ def arel_table(table = nil, reload = nil)
table = table_name if table.blank?
- Relation.new(self, Arel::Table.new(table))
+ if reload || @arel_table.nil? || @arel_table.name != table
+ @arel_table = Relation.new(self, Arel::Table.new(table))
+ end
+ @arel_table
end
private