我尝试使用 public_activity gem 中的#create_activity 存储活动:
模型
class Group < ActiveRecord::Base
include PublicActivity::Common
end
控制器
def send_invitation
@user = User.where(email: params[:user][:email])
@user.create_activity :send_invitation, owner: @group, recipient: @user
redirect_to root_path
end
错误
#User::ActiveRecord_Relation:0x007febb0f0a610 的未定义方法“create_activity”