In Rails what is the before_filter syntax when you want to “except” controller “abc”.
Example, in the application_controller if I want to say:
before_filter :login_required :except => ["-name of controller-"]
Background – Just wanted basic authentication across the whole app except the controller that actually handles getting a user authenticated….
You can put the following line in the controller where the
before_filtershould not be executed:You can even specifiy the methods where the
before_filteris ignored with:onlyand:exceptoptions:An example here.
Edit: with Rails 4,
before_filteris aliased withbefore_action, andskip_before_filteris also aliased withskip_before_action