Respond_to weirdness

Hey all,

Here is the suspect code, description follows.

Mime::Type.register “text/csv”, :csv

def sales_report

respond_to do |f|
f.csv { send_data(csvify(@sales), :filename => “sales-report–
#{@period}.csv”) }
f.html { render(:layout => “sales_report”) }


form tag to generate the report -
form_for(:film_id, :html => {:method => “GET”}, :url =>
formatted_member_sales_report_path(:user_id =>, :id =>, :format => “html”))

link to download generated report as CSV file:
link_to(“Download CSV Report”,
formatted_member_sales_report_path(:user_id =>, :id =>, :format => “csv”))

First of all this is in rails 1.2.3 (yes upgrade is in the works:-).
The weirdness is that everything works perfectly on my local dev box
and our test server running in either development or production mode.
But on our live production box it will only return the HTML page and
never the CSV download.

The only significant differences between the boxes are that we’re
running mod_rails on both my local dev box and the test server but
mongrels on the live/production box. Could that be it? Seems to me
there must be something else going on.

Any thoughts greatly appreciated,

Mime::Type.register “text/csv”, :csv

I’ve had some troubles with this before.
Some thoughts: double check the register stuffs,
try to recreate the production environment on your dev box.
step through with ruby-debug [through the tedious rails stuff] and see
what’s going on.
The only thing I’ve had similar is I registered ‘over’ an existing type
before and that didn’t work because FF3 had its “accept’s” in a
different order than other browsers. Something like that.