views:

47

answers:

2

On the change of a 'select', I'm calling a method in my controller, 'get_sched'. That method just sets a couple variables, then I do a redirect with:

respond_to do |format|
  format.html { redirect_to :action => "index", :id => params[:id] }
end

My log shows that it's redirecting, but the data on my page isn't updating. Do i need to do something else to make it update?

A: 

Changing a select implies you are doing an ajax call, in which case the page won't redirect. Either submit the form, or change your display logic so it doesn't need to redirect.

Paul McMahon
A: 

The ajax call requires special handling if you need to redirect the whole page.

Try this:

respond_to do |format|
  format.html do
    render :update do |page|
      page.redirect_to :action => "index", :id => params[:id]
    end
  end
end
Kevin