Ruby-on-rails 使用设计的 current_user 方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9003792/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 02:41:26  来源:igfitidea点击:

Current_user method using devise

ruby-on-railsdevise

提问by Danny Connolly

I've just started to use devise today and I want to know if I have to create a current user method in my application controller or is it already created through devise ?

我今天刚刚开始使用 devise ,我想知道我是否必须在我的应用程序控制器中创建当前用户方法,还是已经通过 devise 创建了?

回答by Nicolas Garnil

Devise creates that helper method for you, and others too. Check

Devise 为您和其他人创建了这种辅助方法。查看

https://github.com/heartcombo/devise#controller-filters-and-helpers

https://github.com/heartcombo/devise#controller-filters-and-helpers