开发者

what does this mean for linkedin gem? undefined method `downcase' for nil:NilClass

开发者 https://www.devze.com 2023-02-28 15:17 出处:网络
I get the following error now (didn\'t really change code, but started happening): undefined method `downcase\' for nil:NilClass

I get the following error now (didn't really change code, but started happening):

undefined method `downcase' for nil:NilClass

I have this in my controller after authenticating with OmniAuth (and getting/storing the access token/secret

  7   def show 
  8     @user = User.find(params[:id]) 
  9     @client = LinkedIn::Client.new(ENV["LINKEDIN_KEY"], ENV["LINKEDIN_SECRET"]) 
 10     @client.authorize_from_access(@user.atoken, @user.asecret) 
 11     if @user == current_user 
 12       @cl开发者_Go百科ient.profile 
 13     else 
 14       @client.profile(:id => @user.uid) 
 15     end 
 16   end 

Driving me crazy trying to find the problem.


If you paste the complete stacktrace I can give a better solution, but basically, one of the parameters you're passing to one of the methods there, is nil.

Most probably on one of these two lines

@client = LinkedIn::Client.new(ENV["LINKEDIN_KEY"], ENV["LINKEDIN_SECRET"]) 
@client.authorize_from_access(@user.atoken, @user.asecret) 

And if it "just" started happening, without a code change, I would bet my 2 cents that one of the ENV properties is returning nil

0

精彩评论

暂无评论...
验证码 换一张
取 消