问题
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