rails4: cancan or cancancan? with has_secure_password
Asked Answered
T

1

4

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.

Table answered 29/5, 2014 at 20:6 Comment(1)
See github.com/CanCanCommunity/cancancan#missionMckellar
E
13

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.

Earldom answered 30/5, 2014 at 17:6 Comment(2)
Is it possible to update this as it's not clear (although one could guess) what to do for rails 5 and 6 ?Nawrocki
@Nawrocki - cancancan is still being updated. They made a Rails 6 release relatively recently. I've been out of the Rails-world for quite some time, but cancancan still looks like a good option!Earldom

© 2022 - 2024 — McMap. All rights reserved.