简体   繁体   English

rails4:cancan还是cancancan? 使用has_secure_password

[英]rails4: cancan or cancancan? with has_secure_password

I'm trying to implement some type of users so ones can edit data and other can only read. 我正在尝试实现某种类型的用户,以便可以编辑数据,而其他用户只能读取。

user.rb user.rb

class User < ActiveRecord::Base
    has_secure_password
    validates_presence_of :email, :password, :on => :create
end

I'm using has_secure_password (I followes http://railscasts.com/episodes/270-authentication-in-rails-3-1?view=asciicast ) for sessions and I found cancan but I found this: 我正在使用has_secure_password (我关注http://railscasts.com/episodes/270-authentication-in-rails-3-1?view=asciicast )进行会话,我发现了cancan,但我发现了这个:

http://rubygems.org/gems/cancan and http://rubygems.org/gems/cancancan http://rubygems.org/gems/cancanhttp://rubygems.org/gems/cancancan

so, what is the difference? 那么区别是什么呢? which must I use? 我必须使用哪个?

is this guide for rails 3.1 and cancan a good start point or should I look for another approach? rails 3.1和cancan的指南是一个很好的起点,还是我应该寻找另一种方法?

I'm newbie with rails, thanks in advance. 我是铁杆的新手,提前谢谢。

The CanCan project is dead and CanCanCan is a separate project to make a similar authorization solution for Rails 4. In short, CanCan is suitable for Rails 3 apps and CanCanCan is suitable for Rails 4 apps. CanCan项目已经死亡,CanCanCan是一个单独的项目,可以为Rails 4制作类似的授权解决方案。简而言之,CanCan适用于Rails 3应用程序,CanCanCan适用于Rails 4应用程序。 Here is another Stackoverflow answer with some more information about CanCan / CanCanCan. 这是另一个Stackoverflow答案 ,其中包含有关CanCan / CanCanCan的更多信息。

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

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