Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Mike Bethany's Profile

GitHub User: mikbe

Site: http://mikbe.tk

Comments by Mike Bethany

Avatar

FYI: Ryan is way too busy to maintain this gem so the community has taken it over and is keeping it updated. You can find the latest version here:

https://github.com/cancancommunity/cancancan

Avatar

if you have a lot of records you're going to use paginations, you're most likely going to have more records than you want to show on one page, therefore client side is useless.

Avatar

ProTip: Don't use "if not," use "unless."

So the authorize method would go from:

def authorize
  if !current_permission.allow?(params[:controller], params[:action])
    redirect_to root_url, alert: "Not authorized."
  end
end

To the more readable:

def authorize
  unless current_permission.allow?(params[:controller], params[:action])
    redirect_to root_url, alert: "Not authorized."
  end
end
Avatar

Agreed about Devise. It gave me a super quick setup that I almost immediately needed to modify. I'll be taking a look at Sorcery next.

Avatar

FYI if you're using Rails 3 you need to change the line:

<% fields_for 

to:

<%= fields_for