Rails 4.2 & Salesforce API with Restforce returning ActiveModel::ForbiddenAttributesError

爷,独闯天下 提交于 2019-12-12 04:48:48

问题


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.

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.

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

回答1:


Solved in relation to this post and this bug.



来源:https://stackoverflow.com/questions/26589817/rails-4-2-salesforce-api-with-restforce-returning-activemodelforbiddenattrib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!