before_filter doesn't seem to "kick in" <p>I'm trying to get before_filter to work on the actions that requires the user to be logged in, however something must be wrong because it's not.</p> <p>I use a helper file called 'session_helper.rb' for login/logout as well as for checking if the user is logged in (signed_in?). That works fine if used inside an action or in the view, however while using it with the before_filer it's not working. If I log out the user and try to access '/projects/new' it's possible to do that, while it shouldn't be.</p> <p>What am I doing wrong?</p> <p><strong>project controller:</strong></p> <pre><code>class ProjectsController &lt; ApplicationController before_filter :signed_in?, :except =&gt; [:index] // &lt;-- doesn't prevent e.g. the action "new" to be executed def new @project = Project.new @users = (current_user.blank? ? User.all : User.find(:all, :conditions =&gt; ["id != ?", current_user.id])) end def index @projects = Project.all if signed_in? // &lt;-- works as it should @users_projects = Project.where(:user_id =&gt; current_user.id) end end ... other actions ... end </code></pre> <p><strong>sessions_helper.rb</strong></p> <pre><code>module SessionsHelper def sign_in(user) cookies.permanent[:remember_token] = user.remember_token self.current_user = user end def signed_in? !current_user.nil? end def current_user=(user) @current_user = user end def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token]) end def sign_out self.current_user = nil cookies.delete(:remember_token) end end </code></pre>