0
我在Ruby的这种模式,但它抛出一个ActiveModel::ForbiddenAttributesError
ForbiddenAttributesError红宝石
class User < ActiveRecord::Base
def self.from_omniauth(auth)
where(auth.slice("uid", "nickname", "image")).first || create_from_omniauth(auth)
end
def self.create_from_omniauth(auth)
create! do |user|
user.uid = auth["uid"]
user.name = auth["info"]["nickname"]
user.image = auth["info"]["image"]
end
end
end
当我运行这个动作
def auth_callback
user = User.from_omniauth(env["omniauth.auth"])
session[:user_id] = user.id
redirect_to root_url, notice: "signed in!"
end
end
上红宝石2.2.1p85(2015年2月26日修订49769 )[x86_64-linux]
你能告诉我如何摆脱这个错误?
在此先感谢。
我不知道这[问题](https://github.com/plataformatec/devise/issues/3157)是否与此相关。 –
我不认为这是同一个问题。 –