action call with a csv, but render html with flash

Does anyone know how to get an action call with csv to render html with flash? I can get it to work locally but when I upload to the server it keeps trying to render a csv file with the html inside it.

unless flash[:error].blank?       render :template => '/report/action' and return       @content_type = 'text/html'       respond_to do |format|         format.html       end     else       respond_to do |format|         format.html         format.csv { render :layout => false }       end     end