【发布时间】:2018-08-11 07:50:51
【问题描述】:
我以为我重置了我的数据库,但我似乎有剩余用户:
找不到 'id'=4 的用户
app/controllers/application_controller.rb:7:in `current_user'
app/views/layouts/_top_nav.html.erb:29:in `_app_views_layouts__top_nav_html_erb__3420316131555447158_70352716890940'
app/views/layouts/application.html.erb:11:in `_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] DEBUG -- : 用户负载 (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 4]]
如何删除用户(我怀疑用户 1、2、3 也需要删除)
【问题讨论】: