0
嘿我試圖摧毀一個用devise創建的用戶。設計破壞用戶 - 未初始化的常量User :: Profile
這裏是我的文件:
users_controller.rb
before_action :find_user
def destroy
@user.destroy
if @user.destroy
redirect_to admin_users_path, notice: "User destroyed"
end
end
的routes.rb
devise_for :users
match 'users/:id' => 'users#destroy', :via => :delete, :as => :admin_destroy_user
觀點:
= link_to "delete", admin_destroy_user_path(u), method: :delete, data: {confirm: "You sure?"}
,但我得到以下錯誤消息:
NameError in UsersController#destroy
uninitialized constant User::Profile
顯示控制器,你使用參考'Profile'或'用戶:: Profile' –