Ruby 2.3.5 ActiveRecord::RecordNotFound 不知道如何删除

Ruby 2.3.5 ActiveRecord::RecordNotFound cannot figure out how to delete

我以为我重置了我的数据库,但我似乎有剩余用户:

找不到 'id'=4

的用户

app/controllers/application_controller.rb:7:在`current_user'

app/views/layouts/_top_nav.html.erb:29:在`_app_views_layouts__top_nav_html_erb__3420316131555447158_70352716890940'

app/views/layouts/application.html.erb:11:在`_app_views_layouts_application_html_erb___1486453009680454139_40255060'

def current_user
  @current_user ||= User.find(session[:user_id]) if session[:user_id]
end

helper_method :current_user

我已经使用了 bin/rake db:reset 但是当我连接到服务器时仍然得到以下信息:

D,[2018-03-03T03:12:09.426337 #11896] 调试——:用户负载(0.6 毫秒)SELECT "users"。* 从 "users" 哪里 "users"."id" = $1 限制 1 [["id", 4]]

如何删除用户(我怀疑用户1、2、3也需要删除)

问题是 cookie 是客户端。你使用的是什么浏览器?尝试在浏览器上清除 cookies


也许您可以在 :current_user 操作中使用 session.clear,方法是使用 debugger