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
它仍然有效,但什麼導致警告?我該如何擺脫它?