0
我有以下的命名范围:警告
named_scope :find_all_that_match_tag, lambda { |tags| {
:select => "articles.id, tags.name",
:joins => :tags,
:conditions => ["tags.name IN (?)",tags]}
}
它工作正常,像这样的脚本/控制台
Article.find_all_that_match_tag(["cooking"])
但是,如果我使用它像这一点,作为一个匿名范围
scope = Article.scoped({})
scope = scope.scoped.find_all_that_match_tag(["cooking"])
我得到一个警告,第二行的一部分:
/Users/Server/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/named_scope.rb:13: warning: multiple values for a block parameter (0 for 1)
from /Users/Server/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/active_record/named_scope.rb:92
它仍然有效,但什么导致警告?我该如何摆脱它?