0
在我的控制器:Rails的:“你有一个零对象时,你没想到吧”
Article.author_ids_in(params[:filters][:author_ids])
这当然返回如果这些错误(“你有一个无对象...”)特定的参数尚未通过。下面是该模型的方法:
def self.author_ids_in(filters)
unless filters.nil?
where(:author_id + filters)
else
scoped
end
end
正如你所看到的,我已经为nil对象准备,所以我怎么能得到红宝石允许零传递?
你确定你的'params [:filters]'不是'nil'吗?请给出完整的错误信息。 –