not easy to override access_denied
Reported by Bryan Larsen | February 21st, 2011 @ 09:11 PM
The problem: you can define a custom access_denied
function on any controller, and it works fine. However, it cannot
be defined in ApplicationController, because then the definition
happens before the call to hobo_model_controller and gets
overridden by the definition in authentication_support.rb. I tried
wrapping the method definition with unless
method_defined?(:access_denied)
but that didn't work because
of course it's never defined in the AuthenticationSupport module.
If I wrap it with unless
ApplicationController.method_defined?(:access_denied); def
access_denied(user_model)...
it works, but that's pretty
stinky code.
Any thoughts? Perhaps something in Hobo::Controller.included(base)?
Comments and changes to this ticket
-
Bryan Larsen February 21st, 2011 @ 09:19 PM
For now, I'm monkey-patching Hobo::Controller::AuthenticationSupport#access_denied in the app, but that's not something we want the user to have to do, I don't think...
-
Domizio Demichelis April 6th, 2011 @ 05:58 AM
What about moving it to
ActionController::Base
? It should not harm non-hobo controllers: it just doesn't get called. -
Domizio Demichelis April 8th, 2011 @ 02:17 PM
- State changed from new to resolved
(from [749b7b480ac8ffac074eef3f2b2e0cb36b4430e0]) moved #access_denied to ActionController::Base for easy overriding [#922 state:resolved] https://github.com/tablatom/hobo/commit/749b7b480ac8ffac074eef3f2b2...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
People watching this ticket
Referenced by
- 922 not easy to override access_denied (from [749b7b480ac8ffac074eef3f2b2e0cb36b4430e0]) moved #...