How do I get a list of Devise scopes in a rails (4.2.1) app using devise (3.4.1)?
如何使用设计(3.4.1)获取rails(4.2.1)应用程序中的Devise范围列表?
Something like:
> devise_scopes
#=> [User, Admin]
1 个解决方案
#1
Try this:
<% Devise.mappings.each do |scope| %>
<%= scope[0] %>
<% end %>
Additional info on Devise::Mapping
http://www.rubydoc.info/github/plataformatec/devise/Devise/Mapping
关于Devise :: Mapping的其他信息http://www.rubydoc.info/github/plataformatec/devise/Devise/Mapping
#1
Try this:
<% Devise.mappings.each do |scope| %>
<%= scope[0] %>
<% end %>
Additional info on Devise::Mapping
http://www.rubydoc.info/github/plataformatec/devise/Devise/Mapping
关于Devise :: Mapping的其他信息http://www.rubydoc.info/github/plataformatec/devise/Devise/Mapping