title: redirect_to isn't refreshing page in Rails 3
body: <p>I have a Dashboard that contains several bits of information. One of these bits is Events of which the user wants to be reminded. Each of these Events are displayed along w/ an empty checkbox. If the user checks the checkbox, the Event record is updated and the Dashboard should refresh without the recently checked Event.</p>
  
  <p>All this works except for the last part. What makes this so puzzling to me is that a look into the log shows identical logging statements for this redirect to the Dashboard after the update of the Event object as for the original loading of the Dashboard. The query to find which Event objects to display on the Dashboard is run in both cases according to the logs. It's as if the actual update of the Event object doesn't occur quick enough for the subsequent query, and that subsequent query 'finds' the original un-updated data...</p>
  
  <p>Here's the code:</p>
  
  <p>View:</p>
  
  <pre><code>&lt;% @triggered_events.each do |event| %&gt;
        &lt;p&gt;
          &lt;%= image_tag 'indicator.gif', :id =&gt; "indicator-#{event.id}",:style =&gt; 'display: none' %&gt;
          &lt;span class="grayItalics"&gt;&lt;%= truncate(event.title, :length =&gt; 25) %&gt;&lt;/span&gt; --- &lt;% if event.contact_id != nil %&gt;
          &lt;%= full_name_by_contact(Contact.find(event.contact_id)) %&gt; &lt;% end %&gt;
          &lt;%= l event.start, :format =&gt; :yyyyMMdd %&gt; (&lt;%= event.reminder_lead_value %&gt; &lt;%= event.reminder_lead_unit %&gt;)
          &lt;%= check_box_tag 'event[recognized_flag]', "1", event.recognized_flag, :onclick =&gt; toggle_value(event) %&gt;
          &lt;%= link_to 'View Event', event %&gt;
         &lt;hr&gt;
        &lt;/p&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>Helper:</p>
  
  <pre><code>def toggle_value(object)
    remote_function(:url =&gt; dashboard_path(:id =&gt; object),
      :method   =&gt; :put,
      :before   =&gt; "Element.show('indicator-#{object.id}')",
      :complete =&gt; "Element.hide('indicator-#{object.id}')" )
  end
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>def update
  
    @event = Event.find(params[:id])
  
    @event.recognized_flag=true
  
    respond_to do |format|
      if @event.update_attributes(params[:event])
        format.html { redirect_to dashboard_path }
        format.xml  { head :ok }
      else
        format.html { redirect_to dashboard_path }
        format.xml  { render :xml =&gt; @event.errors, :status =&gt; :unprocessable_entity }
      end
    end
  
  end
  </code></pre>
  
  <p>EDIT: adding routes:</p>
  
  <pre><code>get 'dashboard' =&gt; 'dashboard#index'
  put 'dashboard' =&gt; 'dashboard#update' # added specifically for the Event update mentioned in this question
  </code></pre>
  
  <p>Now, this update on an Event object is occuring in the Dashboard controller... which probably isn't the greatest. However the Event controller has it's own 'Update' method in use and redirects to a path different than the Dashboard, so that was not available for this instance... but I don't think it's the cause of this problem. </p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>I'd also add that a refresh of the page (F5) shows that the Event object is being updated (and hence is not displayed on the Dashboard after the F5).</p>