提交 24156526 编写于 作者: R Ryan Bates 提交者: Pratik Naik

Support find_all on named scopes. [#730 state:resolved]

Signed-off-by: NPratik Naik <pratiknaik@gmail.com>
上级 6be8251e
......@@ -103,7 +103,7 @@ class Scope
attr_reader :proxy_scope, :proxy_options
[].methods.each do |m|
unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|find|count|sum|average|maximum|minimum|paginate|first|last|empty?|any?|respond_to?)/
unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|^find$|count|sum|average|maximum|minimum|paginate|first|last|empty?|any?|respond_to?)/
delegate m, :to => :proxy_found
end
end
......
......@@ -238,4 +238,8 @@ def test_should_build_with_proxy_options_chained
assert topic.approved
assert_equal 'lifo', topic.author_name
end
def test_find_all_should_behave_like_select
assert_equal Topic.base.select(&:approved), Topic.base.find_all(&:approved)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册