def list if request.post? @opportunities = Opportunity.find_by_contents(params[:q]) unless params[:unapproved] @opportunities = @opportunities.select {|opportunity| opportunity.approved} end if @opportunities.length > 0 @message = "Search results for '" + params[:q] + "'" else @message = "No search results were found for '" + params[:q] + "'" redirect_to :action => 'search' end end