The before_filter should be in the application_controller rather than being repeated for every controller in the project.