Search code examples
rubyruby-on-rails-3authenticationhttp-redirectbefore-filter

How to apply before_filter to every action of every controller in Rails 3.2.11?


I'd like to verify if the user is logged in on every single request to the server.

Something like:

:before_filter verify_logged_in

Where should I put that before_filter so it applies to all controller actions and all requests?


Solution

  • To ensure that filters apply to all actions, place it in the application_controller.rb.