I am trying to make redirect:
redirect_to :controller => 'forex', :action => 'index', :format => :csv, :paramer => instrument_for_sql
but in log I have:
Redirected to http://localhost:3000/forex/index.csv?paramer=AUDJPY
Completed 406 Not Acceptable in 150ms
But if I paste http://localhost:3000/forex/index.csv?paramer=AUDJPY directly it works.
Any ideas?
class ForexController < ApplicationController
def index
instrument_for_sql = params[:paramer]
receive_csv
respond_to do |format|
format.csv
end
end
routes.rb
match '/forex', :controller => 'forex', :action => 'index', :format => 'csv'
I solved it. I tried to make redirect in respond_to block. Outside it works. When I use format.html in respond_to it works too.