尝试将acts_as_follower gem添加到rails 4应用程序 - 我收到此错误
环境:
用户模型充当跟随者并跟随
PG::NotNullViolation at /follows
ERROR: null value in column "followable_id" violates not-null constraint
DETAIL: Failing row contains (4, null, null, 21, User, f, 2014-03-03 06:35:49.655726, 2014-03-03 06:35:49.655726).
我的代码:
class User < ActiveRecord::Base
acts_as_follower
acts_as_followable
end
follower = User.first
following= User.last
follower.follow(following)
答案 0 :(得分:0)
在开发模式下,您可以运行
rake db:drop db:create db:migrate
更新您的种子数据,然后运行
rake db:seed