RailsCasts Pro episodes are now free!

Learn more or hide this

Mike Bethany's Profile

GitHub User: mikbe

Site: http://mikbe.tk

Comments by Mike Bethany

Avatar

Foreman has a major flaw that makes it a non-starter for me: it can't handle different commands for starting and stopping a service. It also doesn't allow for different environments without using a wrapper shell script.

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