heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.98k stars 5.55k forks source link

undefined method `key?' for #<ActionDispatch::Cookies::CookieJar #1179

Closed saks closed 13 years ago

saks commented 13 years ago

I have just updated devise 1.4.0 => 1.4.1 in my project, and now it throws an exception like this:

devise (1.4.1) lib/devise/strategies/rememberable.rb:12:in `valid?'
warden (1.0.4) lib/warden/proxy.rb:308:in `block in _run_strategies_for'
warden (1.0.4) lib/warden/proxy.rb:306:in `each'
warden (1.0.4) lib/warden/proxy.rb:306:in `_run_strategies_for'
warden (1.0.4) lib/warden/proxy.rb:279:in `_perform_authentication'
warden (1.0.4) lib/warden/proxy.rb:90:in `authenticate'
warden (1.0.4) lib/warden/proxy.rb:100:in `authenticate?'
devise (1.4.1) lib/devise/controllers/helpers.rb:79:in `block in signed_in?'
devise (1.4.1) lib/devise/controllers/helpers.rb:78:in `each'
devise (1.4.1) lib/devise/controllers/helpers.rb:78:in `any?'
devise (1.4.1) lib/devise/controllers/helpers.rb:78:in `signed_in?'
/home/saks/.rvm/gems/ruby-1.9.2-p180@oreklame.kz/bundler/gems/rails-8471d4359607/actionpack/lib/abstract_controller/helpers.rb:53:in `signed_in?'
app/views/layouts/application.html.erb:29:in `_app_views_layouts_application_html_erb__871854582_84583840'
josevalim commented 13 years ago

which Rails version?

saks commented 13 years ago
$ cat Gemfile.lock 
GIT
  remote: git://github.com/chriseppstein/compass.git
  revision: 2124003550bf96e828f6e63351d44a61b647cbf1
  branch: rails31
  specs:
    compass (0.11.3.rails.0.2124003)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.1)

GIT
  remote: git://github.com/lautis/uglifier.git
  revision: 3763a3ec84f425f2759bfd1beb2a12ef2cf3de45
  specs:
    uglifier (1.0.0)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)

GIT
  remote: git://github.com/rails/jquery-rails.git
  revision: 8f0923ddf7ca871169d3398b095bbbca42736235
  specs:
    jquery-rails (1.0.12)
      railties (~> 3.0)
      thor (~> 0.14)

GIT
  remote: git://github.com/rails/rails.git
  revision: 8471d4359607b271e331096a2c77ce0c95b36a74
  branch: 3-1-stable
  specs:
    actionmailer (3.1.0.rc4)
      actionpack (= 3.1.0.rc4)
      mail (~> 2.3.0)
    actionpack (3.1.0.rc4)
      activemodel (= 3.1.0.rc4)
      activesupport (= 3.1.0.rc4)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      i18n (~> 0.6)
      rack (~> 1.3.0)
      rack-cache (~> 1.0.1)
      rack-mount (~> 0.8.1)
      rack-test (~> 0.6.0)
      sprockets (= 2.0.0.beta.10)
      tzinfo (~> 0.3.27)
    activemodel (3.1.0.rc4)
      activesupport (= 3.1.0.rc4)
      bcrypt-ruby (~> 2.1.4)
      builder (~> 3.0.0)
      i18n (~> 0.6)
    activerecord (3.1.0.rc4)
      activemodel (= 3.1.0.rc4)
      activesupport (= 3.1.0.rc4)
      arel (~> 2.1.3)
      tzinfo (~> 0.3.27)
    activeresource (3.1.0.rc4)
      activemodel (= 3.1.0.rc4)
      activesupport (= 3.1.0.rc4)
    activesupport (3.1.0.rc4)
      multi_json (~> 1.0)
    rails (3.1.0.rc4)
      actionmailer (= 3.1.0.rc4)
      actionpack (= 3.1.0.rc4)
      activerecord (= 3.1.0.rc4)
      activeresource (= 3.1.0.rc4)
      activesupport (= 3.1.0.rc4)
      bundler (~> 1.0)
      railties (= 3.1.0.rc4)
    railties (3.1.0.rc4)
      actionpack (= 3.1.0.rc4)
      activesupport (= 3.1.0.rc4)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)

GIT
  remote: git://github.com/rails/sass-rails.git
  revision: eee12e2e0bbfca56d458c82df47213e130ef5830
  specs:
    sass-rails (3.1.0.rc.3)
      actionpack (~> 3.1.0.rc1)
      railties (~> 3.1.0.rc1)
      sass (>= 3.1.3)
      sprockets (>= 2.0.0.beta.9)

GIT
  remote: git://github.com/rtomayko/tilt.git
  revision: a07077f4737754757e99c2d42267f432289ffd13
  specs:
    tilt (1.3.2)

GIT
  remote: git://github.com/saks/mongoid_acts_as_tree.git
  revision: 46232c71154f4c20a1c76d192a78e29548d736b9
  branch: v0.2
  specs:
    mongoid_acts_as_tree (0.1.8)
      bson (>= 1.3.0)
      mongoid (>= 2.0.1)

GIT
  remote: git://github.com/thoughtbot/paperclip.git
  revision: e703662fd40fe43ec7af76266f1e897e9471a873
  branch: rails_3_1_compatibility
  specs:
    paperclip (2.3.10)
      activerecord (>= 2.3.0)
      activesupport (>= 2.3.2)
      cocaine (>= 0.0.2)

GIT
  remote: http://github.com/nmerouze/machinist_mongo.git
  revision: fa4819c4e1233a4e3ce527b68af8aeee85dfc6c3
  branch: machinist2
  specs:
    machinist_mongo (2.0.0.beta.1)
      machinist (~> 2.0.0.beta2)

GEM
  remote: http://rubygems.org/
  specs:
    albino (1.3.3)
      posix-spawn (>= 0.3.6)
    ansi (1.2.5)
    arel (2.1.3)
    bcrypt-ruby (2.1.4)
    bson (1.3.1)
    bson_ext (1.3.1)
    builder (3.0.0)
    cancan (1.6.5)
    capistrano (2.6.0)
      highline
      net-scp (>= 1.0.0)
      net-sftp (>= 2.0.0)
      net-ssh (>= 2.0.14)
      net-ssh-gateway (>= 1.1.0)
    chunky_png (1.2.0)
    cocaine (0.1.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.1.1)
    devise (1.4.1)
      bcrypt-ruby (~> 2.1.2)
      orm_adapter (~> 0.0.3)
      warden (~> 1.0.3)
    erubis (2.7.0)
    execjs (1.2.0)
      multi_json (~> 1.0)
    fssm (0.2.7)
    highline (1.6.2)
    hike (1.1.0)
    i18n (0.6.0)
    kaminari (0.12.4)
      rails (>= 3.0.0)
    kgio (2.5.0)
    machinist (2.0.0.beta2)
    mail (2.3.0)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.16)
    mongo (1.3.1)
      bson (>= 1.3.1)
    mongoid (2.0.2)
      activemodel (~> 3.0)
      mongo (~> 1.3)
      tzinfo (~> 0.3.22)
    mongoid-paperclip (0.0.5)
      paperclip (~> 2.3.6)
    multi_json (1.0.3)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-sftp (2.0.5)
      net-ssh (>= 2.0.9)
    net-ssh (2.1.4)
    net-ssh-gateway (1.1.0)
      net-ssh (>= 1.99.1)
    nokogiri (1.4.6)
    orm_adapter (0.0.5)
    polyglot (0.3.1)
    posix-spawn (0.3.6)
    rack (1.3.0)
    rack-cache (1.0.2)
      rack (>= 0.4)
    rack-mount (0.8.1)
      rack (>= 1.0.0)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.0)
      rack (>= 1.0)
    raindrops (0.7.0)
    rake (0.9.2)
    rdoc (3.8)
    redcarpet (1.17.2)
    sanitize (2.0.2)
      nokogiri (~> 1.4.4)
    sass (3.1.3)
    sprockets (2.0.0.beta.10)
      hike (~> 1.0)
      rack (~> 1.0)
      tilt (!= 1.3.0, ~> 1.1)
    thor (0.14.6)
    treetop (1.4.9)
      polyglot (>= 0.3.1)
    turn (0.8.2)
      ansi (>= 1.2.2)
    tzinfo (0.3.29)
    unicorn (4.0.1)
      kgio (~> 2.4)
      rack
      raindrops (~> 0.6)
    warden (1.0.4)
      rack (>= 1.0)

PLATFORMS
  ruby

DEPENDENCIES
  albino
  bson_ext
  cancan
  capistrano
  coffee-script
  compass!
  devise
  jquery-rails!
  kaminari
  machinist (>= 2.0.0.beta2)
  machinist_mongo!
  mongoid
  mongoid-paperclip
  mongoid_acts_as_tree!
  nokogiri
  paperclip!
  rails!
  redcarpet
  sanitize
  sass
  sass-rails!
  tilt!
  turn
  uglifier!
  unicorn

dwilkie commented 13 years ago

@josevalim it's broken by this commit in Rails: https://github.com/rails/rails/commit/0ca69ca65f83b4bb34f81f077c1c38c66ad868b9#diff-0

CookieJar no longer inherits from Hash so it's missing the method

dwilkie commented 13 years ago

Probably need to add a method to Rails like this:

def key?(key)
  @cookies.key?(key)
end
josevalim commented 13 years ago

fixed on devise and rails master.