我想在仪表板页面上显示缺勤的活动提要。我正在使用公共活动gem.
在我的模态中我添加了
absence.rb
class Absence < ActiveRecord::Base
include PublicActivity::Model
tracked
belongs_to :user
has_many :amendments
end
我想要活动feed的修改
In my controller
class HomeController < ApplicationController
def index
@user = User.new(params[:id])
if user_signed_in?
@activities = PublicActivity::Activity.order("created_at desc")
redirect_to dashboard_users_path
else
redirect_to new_user_session_path
end
end
end
In my view
%h1 Activity Feed
- @activities.each do |activity|
= activity.inspect
但是这给了我未定义的方法每个nil: nil类。我在下面http://railscasts.com/episodes/406-public-activity?view=asciicast为什么我得到这样的错误?
您添加到应用程序控制器的内容是:include PublicActivity::StoreController