diff options
author | José Valim <jose.valim@gmail.com> | 2010-06-30 19:38:20 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-01 00:09:55 +0200 |
commit | 57d750edf7c71e001ac314fa188aa1fc6292f8ab (patch) | |
tree | 5dc0c5492d1ee0ac09ef6abbb67871c0ddf7ae62 /activerecord/lib | |
parent | c63cf7bf0db708fe46a929cf57649ab5a92034af (diff) | |
download | rails-57d750edf7c71e001ac314fa188aa1fc6292f8ab.tar.gz rails-57d750edf7c71e001ac314fa188aa1fc6292f8ab.tar.bz2 rails-57d750edf7c71e001ac314fa188aa1fc6292f8ab.zip |
Make relation a private method.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 11 | ||||
-rw-r--r-- | activerecord/lib/active_record/named_scope.rb | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c8795e4496..c868ff3ae8 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -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. diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb index c010dac64e..849ec9c884 100644 --- a/activerecord/lib/active_record/named_scope.rb +++ b/activerecord/lib/active_record/named_scope.rb @@ -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 |