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 7787533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:42:10+00:00 2026-06-01T20:42:10+00:00

after successful verification from LinkedIn i forward to this controller and i get the

  • 0

after successful verification from LinkedIn i forward to this controller and i get the

uninitialized constant UsersController::LinkedIn

this is where the control goes once the authentication is successful.

class UsersController < ApplicationController
  def index
    # get your api keys at https://www.linkedin.com/secure/developer
    client = LinkedIn::Client.new("ddddd", "eeeee")
    request_token = client.request_token(:oauth_callback =>"http://localhost:3000/users/callback")
    session[:rtoken] = request_token.token
    session[:rsecret] = request_token.secret
    redirect_to client.request_token.authorize_url
  end

  def callback
    client = LinkedIn::Client.new("dddd", "eeeeee")
    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
    @profile = client.profile
    @connections = client.connections
  end
end

Full Trace:

pp/controllers/users_controller.rb:4:in `index'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:414:in `_run__434435962__process_action__199225275__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `send'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
omniauth (1.0.3) lib/omniauth/strategy.rb:168:in `call!'
omniauth (1.0.3) lib/omniauth/strategy.rb:148:in `call'
omniauth (1.0.3) lib/omniauth/builder.rb:42:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__397314981__call__4__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `send'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:162:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:95:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:92:in `each'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:92:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:23:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.4.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.1) lib/rails/commands/server.rb:70:in `start'
railties (3.2.1) lib/rails/commands.rb:55
railties (3.2.1) lib/rails/commands.rb:50:in `tap'
railties (3.2.1) lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6

SessionController :

    class SessionsController < ApplicationController
      def create
        auth = request.env["omniauth.auth"]
        puts "printing"
        puts  auth
        session[:rtoken] = params[:token]
        session[:rsecret] = params[:secret]
        client = LinkedIn::Client.new("cus7tde3g4pe", "jKf6ZYgf8JhMoIJ4")
        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
        @profile = client.profile
        @connections = client.connections
      end
      #user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) || User.create_with_omniauth(auth)
      session[:user_id] = profile.name
      redirect_to root_url, :notice => "Signed in!"
      #end

      def destroy
        session[:user_id] = nil
        redirect_to root_url, :notice => "Signed out!"
      end
    end

Full Trace : 

C:/linkedin/lovelinkedin/app/controllers/sessions_controller.rb:21: undefined local variable or method `session' for Ses
sionsController:Class (NameError)
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
51:in `require'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
51:in `require'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
36:in `load_dependency'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
51:in `require'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:3
59:in `require_or_load'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:3
13:in `depend_on'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
25:in `require_dependency'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:439:in `eager_load!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:438:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:438:in `eager_load!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:436:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:436:in `eager_load!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/application/finisher.rb:53
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instanc
e_exec'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `run_ini
tializers'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_ini
tializers'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/application.rb:136:in `initiali
ze!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `
send'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `
method_missing'
        from C:/linkedin/lovelinkedin/config/environment.rb:5
        from ./test/test_helper.rb:2:in `require'
        from ./test/test_helper.rb:2
        from C:/linkedin/lovelinkedin/test/unit/helpers/linkedin_helper_test.rb:1:in `require'
        from C:/linkedin/lovelinkedin/test/unit/helpers/linkedin_helper_test.rb:1
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `require
'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4
C:/linkedin/lovelinkedin/app/controllers/sessions_controller.rb:21: undefined local variable or method `session' for Ses
sionsController:Class (NameError)
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
51:in `require'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
51:in `require'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
36:in `load_dependency'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
51:in `require'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:3
59:in `require_or_load'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:3
13:in `depend_on'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:2
25:in `require_dependency'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:439:in `eager_load!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:438:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:438:in `eager_load!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:436:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:436:in `eager_load!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/application/finisher.rb:53
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instanc
e_exec'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `run_ini
tializers'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_ini
tializers'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/application.rb:136:in `initiali
ze!'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `
send'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `
method_missing'
        from C:/linkedin/lovelinkedin/config/environment.rb:5
        from ./test/test_helper.rb:2:in `require'
        from ./test/test_helper.rb:2
        from C:/linkedin/lovelinkedin/test/functional/linkedin_controller_test.rb:1:in `require'
        from C:/linkedin/lovelinkedin/test/functional/linkedin_controller_test.rb:1
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `require
'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4

Please help me to solve this as i am new guy to ror.

  • 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-01T20:42:11+00:00Added an answer on June 1, 2026 at 8:42 pm

    UPDATED answer for your sessions_controller question:

    you have to use ‘session’ inside the ‘actions’, e.g. your current code:

    class SessionsController < ApplicationController
      def create
        # ... some code for create action
      end 
    
    # NOTICE:  these 4 lines of code should be placed in an "action"
    #user = User.find_by_provider_and_uid(auth["pr
    session[:user_id] = profile.name
    redirect_to root_url, :notice => "Signed in!"
    #end
    
      def destroy
        # ... some code for destroy action
      end
    end
    

    you should move the 4 lines of code into an action, so that Rails could recorgnize “session”:

    class SessionsController < ApplicationController
      def create
        # ... some code for create action
        session[:user_id] = profile.name
        redirect_to root_url, :notice => "Signed in!"
      end 
    

    =============

    ANSWER for the previous question:

    if you are using Rails3, you have to add every rubygems to the Gemfile, e.g:

    gem "rake", "0.8.7"
    gem 'rails', '3.0.5'
    gem 'linkedin'
    

    here , by adding gem 'linkedin', the ruby code has the ability to include all the stuff comes from ‘linkedin’ gem.

    DEPRECATED Rails 2.x WAY: if you don’t do this, you have to add the require statement in your controller, e.g.

    # don't do this if you are using Gemfile
    require 'linkedin'
    class UsersController < ApplicationController
      def index
      # ... 
    end 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After a successful start of Tomcat and a few REST calls I get this
A session is being passed after successful login from a aspx page to an
I created a paypal checkout. after successful purchase. is there a way to get
How to return user back to the page where he came from, after successful
I am uploading a file by using file upload control. After successful upload, when
After successful setup on initial launch of MySQL, the page prompted me to set
Currently after successful login I add md5($username) md5($password) in cookies and then every time
Hi I have a Sticky form that after successful completion I want to clear
For normal (say Windows Forms) C# applications, to execute commands after a successful build
I'm writing a simple app with AppEngine, using Python. After a successful insert by

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.