mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make relation a private method.
This commit is contained in:
parent
c63cf7bf0d
commit
57d750edf7
2 changed files with 7 additions and 6 deletions
|
@ -896,11 +896,6 @@ module ActiveRecord #:nodoc:
|
|||
store_full_sti_class ? name : name.demodulize
|
||||
end
|
||||
|
||||
def relation
|
||||
@relation ||= Relation.new(self, arel_table)
|
||||
finder_needs_type_condition? ? @relation.where(type_condition) : @relation
|
||||
end
|
||||
|
||||
def arel_table
|
||||
@arel_table ||= Arel::Table.new(table_name, :engine => arel_engine)
|
||||
end
|
||||
|
@ -941,6 +936,12 @@ module ActiveRecord #:nodoc:
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def relation #:nodoc:
|
||||
@relation ||= Relation.new(self, arel_table)
|
||||
finder_needs_type_condition? ? @relation.where(type_condition) : @relation
|
||||
end
|
||||
|
||||
# Finder methods must instantiate through this method to work with the
|
||||
# single-table inheritance model that makes it possible to create
|
||||
# objects of different types from the same table.
|
||||
|
|
|
@ -29,7 +29,7 @@ module ActiveRecord
|
|||
if options.present?
|
||||
scoped.apply_finder_options(options)
|
||||
else
|
||||
current_scoped_methods ? unscoped.merge(current_scoped_methods) : unscoped.clone
|
||||
current_scoped_methods ? relation.merge(current_scoped_methods) : relation.clone
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue