No luck with multiple before_filters


#1

I’ve got these two lines set up in my controller
before_filter :check_authentication
before_filter :check_max_hands, :only => [ :play ]

Here’s the corresponding code for each
def check_authentication
unless session[:user] and authorize?(session[:user])
session[:intended_action] = request.request_uri
redirect_to :controller => ‘user’, :action => ‘signin’
return false
end
end

def check_max_hands
u = current_user
if !u.account_type.unlimited? && u.hands_played_this_month >=
u.account_type.hands
redirect_to :controller => “user”, :action => “upgrade”
end
end

current_user just does User.find params[:user]

With my code like that, I get
“Couldn’t find User without an ID”

If I try to do “return false unless check_authentication” at the
beginning of check_max_hands, I get
“Render and/or redirect were called multiple times in this action…”

I’m pulling my hair out here. All I want is for it to check to see if
the user’s logged in. If not, go to the login page. If so, continue
processing requests. What’s going on?

Pat