Skip to content

Instantly share code, notes, and snippets.

@febuiles
Created December 3, 2008 01:52
Show Gist options
  • Select an option

  • Save febuiles/31391 to your computer and use it in GitHub Desktop.

Select an option

Save febuiles/31391 to your computer and use it in GitHub Desktop.
class FooController
def destroy
editable_by :admin
puts "OH HAI"
end
end
class ApplicationController < ActionController::Base
private
def editable_by(role)
if current_user.role < role
flash[:error] = "GTFO DOOD"
redirect_to "/"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment