Topic: have search field with select list, must use session to paginate?

hello,
i am sure there is a much better way to do this but i dont know how. i basically have a select list that tells my method what model to perform the search on. however, when paginating, i lose the category. therefore i thought i must store category and query in the session. is there a better way? thank you!




    if (params[:search][:search_type] == 'Articles') or
(params[:search][:search_type] == 'Blogs') or
(params[:search][:search_type] == 'Users')
        session[:searchstr] = params[:search][:search_string].to_s
        session[:searchtype]= params[:search][:search_type].to_s
    end

    if  session[:searchtype] == 'Articles'
      @temp = ArticlePost.find_by_contents(session[:searchstr])
      @posts = @temp.paginate :page => params[:page], :per_page => 2
      render :template => 'list_articles'
    end

    if session[:searchtype] == 'Blogs'
      @temp = BlogPost.find_by_contents(session[:searchstr])
      @posts = @temp.paginate :page => params[:page], :per_page => 2
      render :template => 'list_blogs'
    end

    if session[:searchtype] == 'Users'
      @temp = User.find_by_contents(session[:searchstr])
      @posts = @temp.paginate :page => params[:page], :per_page => 2
      render :template => '/list_users'
    end