-
-
Save febuiles/31391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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