Rails: Article.all works, class method therein does not -


how possible? article.all works in console, method called self.retirement_collection therein not. ideas?

class article < activerecord::base ... def self.retirement_collection   articles = articles.all   articles.each |article|     if article.retirement_at < time.now       article.retire     end   end end ... end 

i nameerror when type article.retirement_collection console: nameerror: uninitialized constant article::articles.

it looks mistyped article class when doing article.all,

def self.retirement_collection   articles = article.all # here   articles.each |article|     if article.retirement_at < time.now       article.retire     end   end end 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -