【问题标题】:Rails 4.2 & Salesforce API with Restforce returning ActiveModel::ForbiddenAttributesErrorRails 4.2 & Salesforce API 与 Restforce 返回 ActiveModel::ForbiddenAttributesError
【发布时间】:2014-12-22 18:21:15
【问题描述】:

我正在尝试编写一个 rails 4.2.0.beta2 应用程序,该应用程序将允许我们的组织直接与我们的 salesforce 实例交互。

我一直在关注这个非常有用的条目here

我快到了,我已经在 salesforce 中设置了我的应用程序,它似乎正在触发请求,我可以进入登录页面并输入我的信息。

但是我在回调时收到以下错误。

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

我查看了我的 Sessions 控制器,据说这会给我带来问题……但我无法弄清楚发生了什么。

谁能发现我哪里出错了?

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

【问题讨论】:

    标签: gem salesforce omniauth ruby-on-rails-4.2


    【解决方案1】:

    解决了与this postthis bug 相关的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-30
      • 2013-07-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多