Why is my code returning this error?
@articles = Article.order("id DESC").where(:visible => 1)
if @aritcles.size > 15
@articles = Article.order("id DESC").where(:visible => 1).limit(15)
end
returns:
undefined method `size' for nil:NilClass
If i run
@articles = Article.order("id DESC").where(:visible => 1)
@articles.size
It returns an integer…
If that is from your real code, then you mispelled
articlestoaritcles.If that is different, please provide the real code.