我在 Rails 4 下遇到了 public_activity gem 的问题。我已经正确安装了这个 gem,接下来我输入 rails g public_activity:migration 和 rake db:migrate。在下一步中,我添加
include PublicActivity::Model
tracked
到我的帖子模型并使用索引操作生成控制器活动。我的活动控制器:
class ActivitiesController < ApplicationController
def index
@activities = PublicActivity::Activity.order("created_at desc")
end
end
查看它:
<h1>Friend's Activities</h1>
<% @activities.each do |activity| %>
<%= activity.inspect %>
<% end %>
路线是:
resources :activities
当我去的时候http://localhost:3000/activities
我有错误:
`attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one.
有谁能够帮我?