简体   繁体   English

定义“编辑”方法,使管理员可以更改设计中用户的待处理状态

[英]Defining 'edit' method to let admins change pending status of users in devise

I've been following the wiki for Devise https://github.com/plataformatec/devise/wiki/How-To:-Require-admin-to-activate-account-before-sign_in . 我一直在关注Devise的Wiki https://github.com/plataformatec/devise/wiki/操作方法: -Require-admin-to-activate-account-before-sign_in。 I get the page to display perfectly and everything but once I try to hit edit to change a user's status from pending to approved I get the error 'The action 'edit' could not be found for UsersController'. 我可以使页面完美显示,但是一旦尝试单击edit将用户的状态从待处理更改为已批准,我将收到错误消息“无法为UsersController找到操作'edit'。”

I'm assuming I need to define the 'edit' method in my users_controller.rb file...I'm just not sure how I would code it tell the database to switch the user's status from pending to approved. 我假设我需要在users_controller.rb文件中定义'edit'方法...我只是不确定我将如何编码它告诉数据库将用户的状态从待处理状态切换为已批准状态。

The wiki just gives you the index action and view. Wiki只为您提供索引操作和视图。 You'll also need edit and update controller actions and an edit view for users with a form containing an "approved" checkbox (or select box, whatever floats your boat). 您还需要编辑和更新控制器操作,以及带有包含“已批准”复选框(或选择框,无论您的船是什么)的表单的用户编辑视图。

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

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