class Post < ActiveRecord::Base
belongs_to :users
def self.find_latest_closed
Post.where("status=?",'Closed').order("updated_at DESC").limit(2)
end
def self.find_latest_open
Post.where("status=?",'Open').order("updated_at DESC").limit(2)
end
end
PostController で
class UsersController < ApplicationController
def dashboard
@totalclose = Post.find_latest_closed
@totalopen = Post.find_latest_open
end
end
次のエラーが表示されます
NoMethodError in UsersController#dashboard
undefined method `find_latest_closed' for #<Class:0x000001074eb760>
ここで何が問題なのですか?