Am i using aaf correctly when using a category?

i basically have a search field and a select list for a category…

is this what i have to do? is there a cleaner way? my url becomes very
long.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs