3

I recently ran a bundle update and now I am getting a weird

Type - [17] is not a symbol error.

This is the full error message:

Started GET "/" for 127.0.0.1 at 2013-05-14 03:46:35 -0500

TypeError - [17] is not a symbol:
  (gem) activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in `block in constantize'
  (gem) activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in `constantize'
  (gem) devise-2.2.3/lib/devise/rails/warden_compat.rb:27:in `deserialize'
  (gem) warden-1.2.1/lib/warden/session_serializer.rb:35:in `fetch'
  (gem) warden-1.2.1/lib/warden/proxy.rb:212:in `user'
  (gem) warden-1.2.1/lib/warden/proxy.rb:318:in `_perform_authentication'
  (gem) warden-1.2.1/lib/warden/proxy.rb:104:in `authenticate'
  (gem) warden-1.2.1/lib/warden/proxy.rb:114:in `authenticate?'
  (gem) devise-2.2.3/lib/devise/rails/routes.rb:286:in `block in authenticated'
  (gem) actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:31:in `block in matches?'
  (gem) actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:28:in `matches?'
  (gem) actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:42:in `call'
  (gem) journey-1.0.4/lib/journey/router.rb:68:in `block in call'
  (gem) journey-1.0.4/lib/journey/router.rb:56:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
  (gem) rack-pjax-0.7.0/lib/rack/pjax.rb:12:in `call'
  (gem) newrelic_rpm-3.6.1.88/lib/new_relic/rack/error_collector.rb:12:in `call'
  (gem) newrelic_rpm-3.6.1.88/lib/new_relic/rack/agent_hooks.rb:18:in `call'
  (gem) newrelic_rpm-3.6.1.88/lib/new_relic/rack/browser_monitoring.rb:16:in `call'
  (gem) bullet-4.6.0/lib/bullet/rack.rb:10:in `call'
  (gem) meta_request-0.2.3/lib/meta_request/middlewares/app_request_handler.rb:11:in `call'
  (gem) rack-contrib-1.1.0/lib/rack/contrib/response_headers.rb:17:in `call'
  (gem) meta_request-0.2.3/lib/meta_request/middlewares/headers.rb:16:in `call'
  (gem) meta_request-0.2.3/lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
  (gem) warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
  (gem) warden-1.2.1/lib/warden/manager.rb:34:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  (gem) rack-1.4.5/lib/rack/etag.rb:23:in `call'
  (gem) rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
  (gem) remotipart-1.0.5/lib/remotipart/middleware.rb:30:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
  (gem) rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
  (gem) rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
  (gem) activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
  (gem) activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1566733404690363964__call__3169664716453937753__callbacks'
  (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
  (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:65:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  (gem) better_errors-0.8.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
  (gem) better_errors-0.8.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
  (gem) better_errors-0.8.0/lib/better_errors/middleware.rb:56:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  (gem) railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
  (gem) railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
  (gem) activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
  (gem) railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
  (gem) quiet_assets-1.0.2/lib/quiet_assets.rb:18:in `call_with_quiet_assets'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  (gem) rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
  (gem) rack-1.4.5/lib/rack/runtime.rb:17:in `call'
  (gem) activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  (gem) rack-1.4.5/lib/rack/lock.rb:15:in `call'
  (gem) actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
  (gem) railties-3.2.13/lib/rails/engine.rb:479:in `call'
  (gem) railties-3.2.13/lib/rails/application.rb:223:in `call'
  (gem) rack-1.4.5/lib/rack/content_length.rb:14:in `call'
  (gem) railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in `call'
  (gem) thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
  (gem) thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
  (gem) thin-1.5.1/lib/thin/connection.rb:54:in `process'
  (gem) thin-1.5.1/lib/thin/connection.rb:39:in `receive_data'
  (gem) eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
  (gem) thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
  (gem) thin-1.5.1/lib/thin/server.rb:159:in `start'
  (gem) rack-1.4.5/lib/rack/handler/thin.rb:13:in `run'
  (gem) rack-1.4.5/lib/rack/server.rb:268:in `start'
  (gem) railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
  (gem) railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
  (gem) railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
  script/rails:6:in `<main>'

I am at a complete loss as to what could be causing this all of a sudden.

Don't know if this will help, but this is my Gemfile.lock:

GIT
  remote: git://github.com/ctran/annotate_models.git
  revision: 8bd159c7a484093fde84beaa9e6398f25ddacf09
  specs:
    annotate (2.6.0.beta1)
      activerecord (>= 2.3.0)
      rake (>= 0.8.7)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.13)
      actionpack (= 3.2.13)
      mail (~> 2.5.3)
    actionpack (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    active_utils (1.0.5)
      activesupport (>= 2.3.11)
      i18n
    activemerchant (1.32.1)
      active_utils (>= 1.0.2)
      activesupport (>= 2.3.14)
      builder (>= 2.0.0)
      i18n
      json (>= 1.5.1)
      money
      nokogiri
    activemodel (3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
    activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    acts-as-taggable-on (2.4.1)
      rails (>= 3, < 5)
    addressable (2.3.4)
    arel (3.0.2)
    autoparse (0.3.3)
      addressable (>= 2.3.1)
      extlib (>= 0.9.15)
      multi_json (>= 1.0.0)
    bcrypt-ruby (3.0.1)
    better_errors (0.8.0)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
    binding_of_caller (0.7.1)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (2.3.1.0)
      sass (~> 3.2)
    bootstrap-wysihtml5-rails (0.3.1.19)
      railties (>= 3.0)
    builder (3.0.4)
    bullet (4.6.0)
      uniform_notifier
    cancan (1.6.9)
    carrierwave (0.8.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
    coderay (1.0.9)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.2)
    countries (0.9.2)
      currencies (>= 0.4.0)
    currencies (0.4.0)
    daemons (1.1.9)
    database_cleaner (1.0.0.RC1)
    debug_inspector (0.0.2)
    devise (2.2.3)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.1)
      railties (~> 3.1)
      warden (~> 1.2.1)
    diff-lcs (1.2.4)
    email_spec (1.4.0)
      launchy (~> 2.1)
      mail (~> 2.2)
    erubis (2.7.0)
    eventmachine (1.0.3)
    excon (0.21.0)
    execjs (1.4.0)
      multi_json (~> 1.0)
    extlib (0.9.16)
    faraday (0.8.7)
      multipart-post (~> 1.1)
    fog (1.11.0)
      builder
      excon (~> 0.20)
      formatador (~> 0.2.0)
      google-api-client (~> 0.6.2)
      json (~> 1.7)
      mime-types
      net-scp (~> 1.1)
      net-ssh (>= 2.1.3)
      nokogiri (~> 1.5.0)
      ruby-hmac
    font-awesome-sass-rails (3.0.2.2)
      railties (>= 3.1.1)
      sass-rails (>= 3.1.1)
    formatador (0.2.4)
    friendly_id (4.0.9)
    google-api-client (0.6.3)
      addressable (>= 2.3.2)
      autoparse (>= 0.3.3)
      extlib (>= 0.9.15)
      faraday (~> 0.8.4)
      jwt (>= 0.1.5)
      launchy (>= 2.1.1)
      multi_json (>= 1.0.0)
      signet (>= 0.4.4)
      uuidtools (>= 2.1.0)
    haml (4.0.2)
      tilt
    hike (1.2.2)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (2.2.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (3.0.1)
      jquery-rails
      railties (>= 3.1.0)
    json (1.7.7)
    jwt (0.1.8)
      multi_json (>= 1.5)
    kaminari (0.14.1)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    launchy (2.3.0)
      addressable (~> 2.3)
    letter_opener (1.0.0)
      launchy (>= 2.0.4)
    libv8 (3.11.8.17)
    mail (2.5.3)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    meta_request (0.2.3)
      rack-contrib
      railties
    mime-types (1.23)
    mini_magick (3.5.0)
      subexec (~> 0.2.1)
    money (5.1.1)
      i18n (~> 0.6.0)
    multi_json (1.7.2)
    multipart-post (1.2.0)
    nested_form (0.3.2)
    net-scp (1.1.0)
      net-ssh (>= 2.6.5)
    net-ssh (2.6.7)
    newrelic_rpm (3.6.1.88)
    nokogiri (1.5.9)
    orm_adapter (0.4.0)
    pg (0.15.1)
    piggybak (0.6.30)
      activemerchant
      countries
      devise
      rack-ssl-enforcer
      rails (~> 3.2.8)
      rails_admin (~> 0.4.5)
    piggybak_bundle_discounts (0.0.5)
      rails (~> 3.2.8)
    piggybak_stripe (0.0.2)
      stripe (= 1.7.4)
    piggybak_variants (0.0.17)
      rails (~> 3.2.3)
    polyglot (0.3.3)
    quiet_assets (1.0.2)
      railties (>= 3.1, < 5.0)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-pjax (0.7.0)
      nokogiri (~> 1.5)
      rack (~> 1.3)
    rack-ssl (1.3.3)
      rack
    rack-ssl-enforcer (0.2.5)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.13)
      actionmailer (= 3.2.13)
      actionpack (= 3.2.13)
      activerecord (= 3.2.13)
      activeresource (= 3.2.13)
      activesupport (= 3.2.13)
      bundler (~> 1.0)
      railties (= 3.2.13)
    rails_admin (0.4.7)
      bootstrap-sass (~> 2.2)
      builder (~> 3.0)
      coffee-rails (~> 3.1)
      font-awesome-sass-rails (~> 3.0, >= 3.0.0.1)
      haml (~> 4.0)
      jquery-rails (~> 2.1)
      jquery-ui-rails (~> 3.0)
      kaminari (~> 0.14)
      nested_form (~> 0.3)
      rack-pjax (~> 0.6)
      rails (~> 3.1)
      remotipart (~> 1.0)
      safe_yaml (~> 0.6)
      sass-rails (~> 3.1)
    railties (3.2.13)
      actionpack (= 3.2.13)
      activesupport (= 3.2.13)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.0.4)
    rdoc (3.12.2)
      json (~> 1.4)
    ref (1.0.4)
    remotipart (1.0.5)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    rmagick (2.13.2)
    rolify (3.2.0)
    rspec-core (2.13.1)
    rspec-expectations (2.13.0)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.13.1)
    rspec-rails (2.13.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    ruby-hmac (0.4.0)
    safe_yaml (0.9.1)
    sass (3.2.8)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    sendgrid (1.1.0)
      json
      json
    sextant (0.2.3)
      activesupport (>= 3.2)
      rails (>= 3.2)
    signet (0.4.5)
      addressable (>= 2.2.3)
      faraday (~> 0.8.1)
      jwt (>= 0.1.5)
      multi_json (>= 1.0.0)
    simple_form (2.1.0)
      actionpack (~> 3.0)
      activemodel (~> 3.0)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    stripe (1.7.4)
      multi_json (~> 1.1)
      rest-client (~> 1.4)
    subexec (0.2.3)
    therubyracer (0.11.4)
      libv8 (~> 3.11.8.12)
      ref
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.18.1)
    tilt (1.4.0)
    treetop (1.4.12)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.37)
    uglifier (2.0.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    uniform_notifier (1.2.0)
    uuidtools (2.1.4)
    warden (1.2.1)
      rack (>= 1.0)

PLATFORMS
  ruby

DEPENDENCIES
  acts-as-taggable-on
  annotate!
  better_errors (>= 0.7.2)
  binding_of_caller (>= 0.7.1)
  bootstrap-sass (>= 2.3.0.0)
  bootstrap-wysihtml5-rails
  bullet
  cancan (>= 1.6.9)
  carrierwave
  coffee-rails (~> 3.2.1)
  database_cleaner (>= 1.0.0.RC1)
  devise (>= 2.2.3)
  email_spec (>= 1.4.0)
  execjs
  fog
  font-awesome-sass-rails
  friendly_id
  jquery-rails
  letter_opener
  meta_request
  mini_magick
  newrelic_rpm
  pg (>= 0.15.0)
  piggybak
  piggybak_bundle_discounts
  piggybak_stripe
  piggybak_variants
  quiet_assets (>= 1.0.2)
  rails (= 3.2.13)
  rails_admin
  rmagick
  rolify (>= 3.2.0)
  rspec-rails (>= 2.12.2)
  sass-rails (~> 3.2.3)
  sendgrid (>= 1.0.1)
  sextant
  simple_form (>= 2.1.0)
  therubyracer
  thin (>= 1.5.0)
  uglifier (>= 1.0.3)

Edit 1

Here is my Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.13'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

group   :development do
    gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
    gem 'sextant'
  gem "quiet_assets", ">= 1.0.2"
  gem "better_errors", ">= 0.7.2"
  gem "binding_of_caller", ">= 0.7.1"    
    gem 'meta_request'
    gem 'execjs'
    gem 'therubyracer'  
  gem "letter_opener"
  gem 'bullet'   
  # gem 'rack-mini-profiler'   
end

group :test do
  gem "database_cleaner", ">= 1.0.0.RC1"
  gem "email_spec", ">= 1.4.0"
end

group :development, :test do
  gem "rspec-rails", ">= 2.12.2"
end

gem 'jquery-rails'
gem "thin", ">= 1.5.0"
gem "pg", ">= 0.15.0"
gem "font-awesome-sass-rails"
gem "bootstrap-sass", ">= 2.3.0.0"
gem "bootstrap-wysihtml5-rails"
gem "bootstrap-sass", ">= 2.3.0.0"
gem "sendgrid", ">= 1.0.1"
gem "devise", ">= 2.2.3"
gem "cancan", ">= 1.6.9"
gem "rolify", ">= 3.2.0"
gem "simple_form", ">= 2.1.0"
gem "newrelic_rpm"
gem "rmagick"
gem "mini_magick"
gem "carrierwave"
gem "fog"
gem "piggybak"
gem "piggybak_variants"
gem "piggybak_bundle_discounts"
gem "rails_admin"
gem "acts-as-taggable-on"
gem "friendly_id"
gem "piggybak_stripe"
Nazar Hussain
  • 5,102
  • 6
  • 40
  • 67
marcamillion
  • 32,933
  • 55
  • 189
  • 380
  • Could you paste your Gemfile (not the `.lock`)? Things can go wrong during updates unless gems are given maximum versions that they can update to. – Jon Cairns May 14 '13 at 08:55
  • 2
    From your log, something seems to be wrong while deserializing a session. Just a guess, are you trying to access your site with the same session running before the bundle update? Can you clear your browser's cookies in order to start a new session? – Lazarus Lazaridis May 14 '13 at 08:59
  • @grotori - you seem to be dead on the money. I tested the site in `InCognito Mode` in Chrome and that works. How do I fix it, though, so that my users don't get hit with this error when they have their window open for a long period of time. Force logout after 30 minutes or w/e? Btw, I did log out multiple times in my normal browser window and that never helped. In fact, I had restarted my machine (because the app was acting funny) and that's when I started getting this error. How do I fix it? – marcamillion May 14 '13 at 09:11
  • I don't know if there is any way to clear the session "store" that rails uses but you should check on this approach. – Lazarus Lazaridis May 14 '13 at 09:15
  • Agree with @grotori. I'm guessing you upgraded Devise between versions that changed how sessions are serialized/deserialized. You'll have to force logout for all your users... You can do this simply by changing the secret session store key in your config when you deploy the new Devise version. – rossta May 14 '13 at 09:40
  • That's the thing, if you look in my `Gemfile` you will see that devise is locked at a specific version. `>= 2.2.3`. That is the version being used - so it was never upgraded. – marcamillion May 14 '13 at 10:10

3 Answers3

7

There are a few things to note here:

  1. It's safer to specify maximum versions to update to in your Gemfile
  2. Your session is not deserializing correctly - this is the cause of the exception you're seeing
  3. If you're having trouble with a single gem and need to update, use bundle update <gem name>

Specify maximum Gem versions

You should get into the practice of using the pessimistic version constraint (the ~> operator) in your Gemfile. This essentially allows you to say that gems can only be updated to higher patch levels.

Ruby developers tend to use the standard of version numbers with three numbers: x.x.x, e.g. 2.0.1. The first number is the major version, the second number the minor version and the third number is the patch.

Major version updates are likely to break old functionality. If you upgrade from 1.x.x to 2.x.x, it could be a painful process. Minor version updates should add features and, in rare cases, change existing functionality, but it should be backwards compatible. Patch level updates should be purely bug fixes.

The pessimistic version constraint can be used to say "only allow patch level updates". For example:

gem 'devise', '~> 2.2.3'  # Only the '.3' can increase, e.g. 2.2.4, 2.2.5

If you do this for all of your gems then you can be reasonably sure that bundle update will update gems to compatible versions. In your Gemfile you have

gem 'devise', '>= 2.2.3'

This would potentially allow the installation of devise 3.0.0, which you can almost guarantee would be problematic.

It's good practice to find a gem configuration that works, then use the pessimistic version constraint to lock your Gemfile down to only patch level updates.

Session deserialization

It looks like devise has been updated, which has caused a session deserialization problem. You could check out an old version of your Gemfile.lock, then downgrade to the devise version that was working. Or you could just clear your cache if you don't have anything critical in the session and use the new version.

Update a single gem

Running bundle update will attempt to update all gems in your Gemfile. If you only need to update a single gem, use bundle update <gem name>. All the others will remain at the same version.

Community
  • 1
  • 1
Jon Cairns
  • 11,783
  • 4
  • 39
  • 66
  • Where do you see evidence that it was actually updated? I just checked out an earlier branch and the version numbers seem to be the same. – marcamillion May 14 '13 at 10:15
  • I am seeing that `Devise 3.0.0.rc` was released in the last 7 days. Why am I not seeing 3.0 in my Gemfile.lock? That could be causing this, but I am not seeing evidence of 3.0 in my Gemfile or Gemfile.lock. Am I missing something? – marcamillion May 14 '13 at 10:19
  • I don't think release candidates are favoured by bundler, so it probably didn't update that far. It may be worth doing a diff between your Gemfile.lock, to see exactly what changed. Was there a reason that you did a `bundle update`? – Jon Cairns May 14 '13 at 10:21
  • I was having problems with piggybak, that I hoped a fork would fix. Then it just updated a bunch of stuff and broke many others. – marcamillion May 14 '13 at 17:02
  • @marcamillion you can update just a single gem, see revised answer – Jon Cairns May 15 '13 at 08:41
  • For what it's worth, I changed all my gems to be `~> x.x.x` and that created a bunch of headache for me. I just reverted to what worked before. I also fixed this issue, and added it as an answer. – marcamillion May 15 '13 at 22:41
  • Wow thanks so much @joonty . You just changed my life! – Trip Apr 09 '14 at 09:53
5

The question was posted a long time ago so I suppose the original person doesn't need the answer anymore. But there might be people like me who is in desperate need for an answer other than blowing up all sesssions. Here's the cause and my solution: Devise 2.2.4 has backward incompatible changes that breaks all existing session. See the change log for 2.2.4 https://github.com/plataformatec/devise/blob/master/CHANGELOG.md

Sessions created by devise >=2.2.4 cannot be correctly handled by devise <=2.2.3.

The problem comes from the session keys devise used. Let's say you have devise on your Player model. For devise<=2.2.3, the session has the following in the session

session["warden.user.player.key']=["Player", [player_id], "somehashhere"]

For devise>=2.2.4, the session becomes the following

session["warden.user.player.key']=[[player_id], "somehashhere"]

I suppose the devise author don't like the "Player" as it's already specified in a lot of different places as well as the key itself. It's a reasonable change and the new code does handle the upgrade correctly as it can understand the old sessions and keeps your outstanding sessions alive.

But that only solves the problem for upgrade, not downgrade. If you upgrade your devise to 2.2.4, log in and then downgrade to 2.2.3, you will see an error like this. Apparently somewhere in devise code (<2.2.3) it converts the 'Play' into symbol :user. But the 'User' is not there anymore and you got a 'not a symbol' error.

Devise page points to a solution only if you use db storage for session. You would need a migration for that https://gist.github.com/moll/6417606

If you use cookie store storage (rails default for a long time), then you need to add the following code to application controller when you downgrade from later version of devise

before_filter :fix_session
def fix_session
    key = session["warden.user.player.key"]
    if key && key.is_a?(Array) && key[0].is_a?(Array)
      session["warden.user.player.key"].unshift('Player')
    end
end

As for why downgrading? If you are sure that everything works and you will never have to rollback then it's not an issue. But if you are not so sure, you will need this.

user3294438
  • 371
  • 3
  • 5
2

I updated my Gemfile to gem "devise", ">= 2.2.4" and then deleted my Gemfile.lock and re-created it by doing bundle install.

For whatever reason, that seems to have fixed this particular issue.

I can't say, for sure, though that it was caused by that version of Devise. It could have been another gem that got updated - but that's the only change I made that has worked.

So take that with a grain of salt.

marcamillion
  • 32,933
  • 55
  • 189
  • 380
  • you're still in danger of devise updating to any version above your current one - that's what the `>= 2.2.4` means. Still, glad it's working for you now. – Jon Cairns May 16 '13 at 08:24