Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 272
Andres Avatar asked Dec 11 '22 05:12

Andres


1 Answers

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.

like image 53
Powers Avatar answered Dec 29 '22 11:12

Powers