问题描述
我试图编写一个rails 4.2.0.beta2应用程序,它可以让我们的组织直接与我们的salesforce实例进行交互。
I'm trying to write a rails 4.2.0.beta2 app that will allow our organisation to interface directly with our salesforce instance.
我一直在关注这非常有用的条目。
I've been following this really useful entry here.
我快到了,我已经在salesforce中设置了应用程序设置,它似乎在解决请求问题,我可以进入登录页面并输入我的信息。
I'm nearly there, i've got my app setup in salesforce, it appears to be firing off the request ok, I can get to the login page and enter my inforamation.
然而,我在回调时收到以下错误。
However I'm getting the following error upon callback.
ActiveModel::ForbiddenAttributesError in SessionsController#create
ActiveModel::ForbiddenAttributesError
enter code hereExtracted source (around line #21):
def sanitize_for_mass_assignment(attributes)
if attributes.respond_to?(:permitted?) && !attributes.permitted?
raise ActiveModel::ForbiddenAttributesError
else
attributes
end
I looked into my Sessions controller which is supposedly causing me a problem... but I can't work out what's going on.
任何人都可以发现我在哪里我看到我的Sessions控制器,这应该会导致我的问题......但我无法弄清楚发生了什么事情。 '这里出错了吗?
Can anyone spot where i've gone wrong here?
class SessionsController < ApplicationController
def create
user = User.from_omniauth(env["omniauth.auth"])
session[:user_id] = user.id
redirect_to root_url
end
def destroy
session[:user_id] = nil
redirect_to root_url
end
end
推荐答案
解决与和。
这篇关于Rails 4.2&带有Restforce的Salesforce API返回ActiveModel :: ForbiddenAttributesError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!