GitHub User: mikbe
Site: http://mikbe.tk
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
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.
FYI if you're using Rails 3 you need to change the line:
<% fields_for
to:
<%= fields_for
ProTip: Don't use "if not," use "unless."
So the authorize method would go from:
To the more readable:
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.
FYI if you're using Rails 3 you need to change the line:
to: