Skip to content

Instantly share code, notes, and snippets.

@paulcsmith
Created November 28, 2016 17:13
Show Gist options
  • Save paulcsmith/226ef9a8265875a5d933d7386a029934 to your computer and use it in GitHub Desktop.
Save paulcsmith/226ef9a8265875a5d933d7386a029934 to your computer and use it in GitHub Desktop.
class Controller
@@checked_authorization = false
macro inherited_at_end
unless @@checked_authorization
raise "Forgot to check authorization"
end
end
macro require_permission(permission_name)
@@checked_authorization = true
# check authorization and redirect if not authorized
end
end
class SuperSecretController < Controller
# If I forget to add this I'd like to raise at compile time
require_permission "can-access-secret-stuff"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment