Forum: Ruby on Rails No luck with multiple before_filters

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Pat M. (Guest)
on 2006-05-19 16:56
(Received via mailing list)
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

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

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?

This topic is locked and can not be replied to.