The Devise::RegistrationsController has this code:
class Devise::RegistrationsController < DeviseController
prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
I’m subclassing this controller, and I ran into a subtle difference in the way that I call prepend_before_filter:
The this does not work in the subclass
prepend_before_filter :authenticate_scope!, :only => [:update_password]
This does work
prepend_before_filter :only => [:update_password] { authenticate_scope! }
And this also works.
prepend_before_filter :authenticate_scope!, :only => [:update_password, :edit, :update, :destroy]
It seems that if you call prepend_before_filter in a subclass, you cannot simply add to the only
list.
Would this be a bug? It’s certainly not expected.
I’m guessing that the technique of passing a block is better in terms of upgrading Devise in the future.