我用 devise 做用户注册及登录当我点击登录时候出现下面错 NameError in Devise::SessionsController#create 网上找了下 有帖说要修改“可以通过修改 /config/initializers/cookie_verification_secret.rb中的secret key 来修正” 但我在/config/initializers/找不到 cookie_verification_secret.rb 文件 我用的 rails 是 3.1.3 在线求助
undefined local variable or method `root_path' for #<Devise::SessionsController:0x00000004574fc8>
Rails.root: /home/gsm/rails-work/devisedemo
Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"X0kgzO8B2+AEMsffoKLcdTstYOaPDBvWmTAFGQXfRPQ=",
"user"=>{"email"=>"[email protected]",
"password"=>"[FILTERED]",
"remember_me"=>"0"},
"commit"=>"Sign in"}
Show session dump
_csrf_token: "X0kgzO8B2+AEMsffoKLcdTstYOaPDBvWmTAFGQXfRPQ="
flash: #<ActionDispatch::Flash::FlashHash:0x00000004cd1320 @used=#<Set: {}>, @closed=false, @flashes={:notice=>"Signed in successfully."}, @now=nil>
session_id: "f85426884953ea3639bcaa4d9ed10acb"
warden.user.user.key: ["User", [1], "$2a$10$.tmwyk7zABbzjP.sDA./6O"]
Show env dump
GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_CHARSET: "GBK,utf-8;q=0.7,*;q=0.3"
HTTP_ACCEPT_ENCODING: "gzip,deflate,sdch"
HTTP_ACCEPT_LANGUAGE: "zh-CN,zh;q=0.8"
HTTP_CACHE_CONTROL: "max-age=0"
REMOTE_ADDR: "127.0.0.1"
REMOTE_HOST: "localhost"
SERVER_NAME: "localhost"
SERVER_PROTOCOL: "HTTP/1.1"
你是 3.1.3 么?我不记得怎么解决的了,railscast 那个视频的做法好像没用,把 route 最后那行(match 'controller'xxxxxxxxxxxxxxxxxx)uncommen 一下试试