Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7906805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:08:32+00:00 2026-06-03T11:08:32+00:00

I am storing some values in session this is what is my controller where

  • 0

I am storing some values in session this is what is my controller where i store values in session :

def callback
    client = LinkedIn::Client.new("ssssssssssss", "444444444444")
    if session[:atoken].nil?
      pin = params[:oauth_verifier]
      atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
      session[:atoken] = atoken
      session[:asecret] = asecret
    else
      client.authorize_from_access(session[:atoken], session[:asecret])
    end
    @loggedin_linkedin_userinfo = client.profile(:fields => [:id,:summary, :headline, :first_name, :last_name, :picture_url])
    @loggedin_linkedin_education = client.profile(:fields => [:educations])
    @loggedin_linkedin_position = client.profile(:fields => [:positions])
    @loggedin_linkedin_connections = client.connections

    session[:link_total] = @loggedin_linkedin_connections["total"]
    session[:link_headline] = @loggedin_linkedin_userinfo["headline"]
    session[:link_first_name] = @loggedin_linkedin_connections["first_name"]
    session[:link_last_name] = @loggedin_linkedin_connections["last_name"]
    session[:link_summary] = @loggedin_linkedin_connections["summary"]
    session[:picture_url] = @loggedin_linkedin_connections["picture_url"]

    redirect_to  :controller => 'home', :action => 'index'  
  end

this what is my view :

<div class="datainfo profile">
                        <h2 class="inner">Welcome, 
                            <% if session[:user].nil? 
                                session[:link_first_name] + " " + session[:link_last_name]
                            else
                                session[:user].first_name + " " + session[:user].last_name
                            end %>
                            </h2>
                        <p class="loc">
                            <%  
                            if session[:user].nil? 
                                Linkedinuser
                             else
                             @countryDetails = Country.find(:all, :conditions => {:id => session[:user].country_id})    
                            end
                                #for c in countryDetails
                                #c.country_name  #loop
                            %>
                            <% if session[:user].nil? 
                               Linkedinuser 
                             else
                                session[:user].city + "," + @countryDetails[0].country_name.to_s    
                            end
                            %>
                        </p>
                        <p class="job">

                        </p>
                        <p class="status">
                            <spam>
                                <% if session[:user].nil? 
                                        Linkedinuser
                                    else
                                        link_to "Complete Profile", session[:user], :class=>"small-btn" 
                                end
                            %>
                            </spam>
                            - Profile Completed %.
                        </p>
                    </div>

but when i run this i get the following error, Please help me.

undefined method `+' for nil:NilClass

Extracted source (around line #35):

32:                     <div class="datainfo profile">
33:                         <h2 class="inner">Welcome, 
34:                             <% if session[:user].nil? 
35:                                 session[:link_first_name] + " " + session[:link_last_name]
36:                             else
37:                                 session[:user].first_name + " " + session[:user].last_name
38:                             end %>

I am struggling from morning but could not find a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:08:34+00:00Added an answer on June 3, 2026 at 11:08 am

    There is no :link_first_name key in your session (or it’s nil) that’s why it says + method is not defined for nils.

    Check your session before doing that:

    <% if session[:user].nil? && !session[:link_first_name].nil?
      session[:link_first_name] + " " + session[:link_last_name]
    else ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm considering storing some date values as ints. i.e 201003150900 Excepting the fact that
I have some double values I want to convert to a string with this
I have a method to retrieve session variables, in this case Organizations. For some
I have used session to store some config setting in MVC3 application, in my
I am printing some values on a JSP from session using < bean:write />
I parse some values from an xml file. There is a @25-12-2010'T'23:40:00 string with
Let's say I've got: Dim los1 as New List(Of String) los1.Add(Some value) Dim los2
I'm receiving a string like this: { key1 = some value; key2 = some
I want to use cookies for storing userId during the session which lets to
So I have some session checking to see if it's not stolen using PHP.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.