简体   繁体   English

Ruby on Rails装置-没有路线与[GET]“ / users”匹配

[英]Ruby on Rails devise - No route matches [GET] “/users”

First time using devise I'm a little confused. 第一次使用devise时,我有些困惑。 I've followed a tutorial that manually goes through authentication so I have some understanding of Rails in this respect. 我遵循了手动进行身份验证的教程,因此我在这方面对Rails有所了解。

Normally when you create a scaffold for a User you get a Users controller with all the methods for showing, editing, adding etc. users, which can be accessed through the browser via http://localhost:3000/users/[action] . 通常,当为用户创建支架时,您会获得一个用户控制器,其中包含显示,编辑,添加用户等所有方法,可以通过浏览器通过http://localhost:3000/users/[action]

I have destroyed the User scaffold and started again with devise (rails generate devise User) but this does not create a controller at all. 我已经销毁了User支架,并重新开始使用devise(rails生成devise User),但这根本不会创建控制器。 Going to http://localhost:3000/users/ gives the error No route matches [GET] "/users" . 转到http://localhost:3000/users/会给出错误: No route matches [GET] "/users"

Am I supposed to create my own controller? 我应该创建自己的控制器吗? Where do I go from here? 我从这里去哪里?

I think you did not initialized devise. 我认为您没有初始化设计。 You should probably run 你应该跑

rails generate devise:install

And then generate model for User by running 然后通过运行为用户生成模型

rails generate devise User

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM