diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-21 12:15:57 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-21 12:15:57 -0300 |
commit | 6931bed1b41ae9d8b5ba4978156211082b873816 (patch) | |
tree | 88b6b7cd12c6935433fbfad8e6adf95e237d699f /activerecord/lib | |
parent | 1a6b25574fdc831ff4c100642b5e0bfe529fe08f (diff) | |
download | rails-6931bed1b41ae9d8b5ba4978156211082b873816.tar.gz rails-6931bed1b41ae9d8b5ba4978156211082b873816.tar.bz2 rails-6931bed1b41ae9d8b5ba4978156211082b873816.zip |
Revert "Merge pull request #14544 from jefflai2/named_scope_sti"
This reverts commit 9a1abedcdeecd9464668695d4f9c1d55a2fd9332, reversing
changes made to c72d6c91a7c0c2dc81cc857a1d6db496e84e0065.
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/models/comment.rb
This change break integration with activerecord-deprecated_finders so
I'm reverting until we find a way to make it work with this gem.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/scoping.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/scoping/named.rb | 8 |
2 files changed, 4 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index fca4f1c9d3..3e43591672 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -11,11 +11,11 @@ module ActiveRecord module ClassMethods def current_scope #:nodoc: - ScopeRegistry.value_for(:current_scope, self.to_s) + ScopeRegistry.value_for(:current_scope, base_class.to_s) end def current_scope=(scope) #:nodoc: - ScopeRegistry.set_value_for(:current_scope, self.to_s, scope) + ScopeRegistry.set_value_for(:current_scope, base_class.to_s, scope) end end diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index 826b710e92..49cadb66d0 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -148,13 +148,9 @@ module ActiveRecord extension = Module.new(&block) if block singleton_class.send(:define_method, name) do |*args| - if body.respond_to?(:to_proc) - scope = all.scoping { instance_exec(*args, &body) } - else - # Body is given as an object instead of a block, so invoke call() - scope = all.scoping { body.call(*args) } - end + scope = all.scoping { body.call(*args) } scope = scope.extending(extension) if extension + scope || all end end |