为什么我的代码返回此错误?
@articles = Article.order("id DESC").where(:visible => 1)
if @aritcles.size > 15
@articles = Article.order("id DESC").where(:visible => 1).limit(15)
end
返回:
undefined method `size' for nil:NilClass
如果我跑
@articles = Article.order("id DESC").where(:visible => 1)
@articles.size
它返回一个整数...