简体   繁体   中英

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

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:

http://rubygems.org/gems/cancan and http://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?

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. Here is another Stackoverflow answer with some more information about CanCan / CanCanCan.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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