生成设备控制器-Rails Devise [英] Generating Devise Controllers - Rails Devise

查看:67
本文介绍了生成设备控制器-Rails Devise的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次尝试设计。我在跟踪链接: https://github.com/ plataformatec / devise 。在这里,我执行了以下命令:

 导轨生成设计模型
预先感谢。

解决方案

设计了许多命令提供。


  1. rails generate devise:install -将创建 config / devise.rb

  2. rails generate devise User -将创建 db / migration-file-for-user-model 其中的注释代码,如果需要其他模块,则可以注释。 。例如 confirmable omniauth

  3. rails generate devise:views -将在 devise 文件夹中使用 app / views / devise / sessions创建所有视图 app / views / devise / confirmations registrations etc文件夹及其视图。

  4. rails生成devise:views用户-将创建 app / views / users / passwords / app / views / users / confirmations ..etc而不是上面的 devise 文件夹。

  5. rails generate devise:controllers -将创建所有 controllers .. 类似于上面 ...在此处,它将使用默认的注释代码创建 app / controllers / devise / sessions_controller.rb ,您需要对其进行编辑否则,请保留它以用于基本身份验证。此外,还可以最后添加个用户 作用域,以在<$ c $中生成控制器c> controllers / users / 而不是 controllers / devise /

您也可以阅读这篇很好的 设计教程 > ..



希望有帮助。


I am trying devise for the first time.I am following the link:https://github.com/plataformatec/devise. Here,i have executed the command:

rails generate devise MODEL

when i have executed this,the model and view parts are created.When i checked the routes,I have noticed that there is a controller created with the name:MODEL.but i didnot find the controller in the project.My query is how can we find whether a controller is generated or not and use that controller in the project. Thanks in advance.

解决方案

There are many commands that devise provides..

  1. rails generate devise:install - will create config/devise.rb
  2. rails generate devise User - will create db/migration-file-for-user-model which commented code,which you can uncomment,if you need other modules..such as confirmable,omniauth etc
  3. rails generate devise:views - will create all views in the devise folder with app/views/devise/sessions,app/views/devise/confirmations,registrations etc folder and its views respectively.
  4. rails generate devise:views users - will create folder of app/views/users/passwords/,app/views/users/confirmations ..etc instead of devise folder above.
  5. rails generate devise:controllers - will create all controllers..similar to above...here it will create app/controllers/devise/sessions_controller.rb with default commented code,which you need to edit else leave it as it is for basic authentication.Moreover,you can also add users scope in the end,to generate controllers in controllers/users/ and not controllers/devise/

You may also go through this good devise tutorial ..

Hope it helps.

这篇关于生成设备控制器-Rails Devise的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆