资源在Devise中是什么意思?

编程入门 行业动态 更新时间:2024-10-26 12:30:39
本文介绍了资源在Devise中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想更改用户登录时在设计中发生的事情。当我查看源代码时,资源一词无处不在,但我不明白它代表什么。

I want to change what happenes in devise when a user logs in.. When I look at the source code the word resource is everywhere, but I can't understand what it is a stand in for. Does it only pertain to devise and warden?

def after_sign_in_path_for(resource) stored_location_for(resource) || if resource.is_a?(User) && resource.can_publish? publisher_url else super end end

推荐答案

资源是用户实例的抽象名称。可以在devise设置中对其进行配置,以与Admin模型或任何其他模型一起使用。

Resource is an abstraction name of instance of a user. It can be configured in devise settings to work with Admin model or any other.

默认情况下,这是您在路线中声明的第一个devise角色

By default it's the first devise role declared in your routes

devise :users # resource is instance of User class devise :admins # resource is instance of Admin class

更多推荐

资源在Devise中是什么意思?

本文发布于:2023-11-03 01:14:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1553884.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:资源   Devise

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!