title: Bootstrap modal not dismissing after form submit in Rails
body: <p>I'm having trouble with a bootstrap modal in my Rails 3 app. It currently handles a review form that submits and updates the DB just fine, but the modal doesn't close when the form is submitted. I've tried adding this to the form submit button:</p>
  
  <pre><code>:data =&gt; {:dismiss =&gt; "modal"}
  </code></pre>
  
  <p>But it closes the modal without executing the update action. Here's my modal code as it stands:</p>
  
  <pre><code>&lt;!-- Review Modal --&gt;
  &lt;% if current_user == nil %&gt;
  &lt;% else %&gt;
  &lt;div id="reviewModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="reviewModalLabel" aria-hidden="true"&gt;
    &lt;div class="modal-header"&gt;
      &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;
      &lt;h3 id="reviewModalLabel"&gt;Write a review&lt;/h3&gt;
    &lt;/div&gt;
    &lt;div class="modal-body"&gt;
    &lt;%= form_for(review_ballot, :remote =&gt; true, :html =&gt; {:class =&gt; 'review_ballot'}) do |f| %&gt;
      &lt;h4&gt;Your score:&lt;/h4&gt;
      &lt;%= f.label("score_1", content_tag(:span, '1'), {:class=&gt;"review", :id=&gt;"1"}) %&gt;
      &lt;%= radio_button_tag("review[score]", 1, current_user_review == 1, :class =&gt; 'review_button')%&gt;
      &lt;%= f.label("score_2", content_tag(:span, '2'), {:class=&gt;"review", :id=&gt;"2"}) %&gt;
      &lt;%= radio_button_tag("review[score]", 2, current_user_review == 2, :class =&gt; 'review_button')%&gt;
      &lt;%= f.label("score_3", content_tag(:span, '3'), {:class=&gt;"review", :id=&gt;"3"}) %&gt;
      &lt;%= radio_button_tag("review[score]", 3, current_user_review == 3, :class =&gt; 'review_button')%&gt;
      &lt;%= f.label("score_4", content_tag(:span, '4'), {:class=&gt;"review", :id=&gt;"4"}) %&gt;
      &lt;%= radio_button_tag("review[score]", 4, current_user_review == 4, :class =&gt; 'review_button')%&gt;
      &lt;%= f.label("score_5", content_tag(:span, '5'), {:class=&gt;"review", :id=&gt;"5"}) %&gt;
      &lt;%= radio_button_tag("review[score]", 5, current_user_review == 5, :class =&gt; 'review_button')%&gt;
    &lt;br /&gt;
      &lt;h4&gt;What'd you think?&lt;/h4&gt;
    &lt;%= f.text_area :review_text, :rows =&gt; 3, :cols =&gt; 10 %&gt;
    &lt;%= hidden_field_tag :venue_id, @venue.id %&gt;
    &lt;/div&gt;
    &lt;div class="modal-footer"&gt;
      &lt;button class="btn" data-dismiss="modal" aria-hidden="true"&gt;Close&lt;/button&gt;
      &lt;%= submit_tag "Save review", :class =&gt; "btn btn-warning" %&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And here's the venue helper for the review_ballot method</p>
  
  <pre><code>module VenuesHelper
    def review_ballot
      if @review = current_user.reviews.find_by_venue_id(params[:id])
        @review
      else
        current_user.reviews.new
      end
    end
  
    def current_user_review
      if @review = current_user.reviews.find_by_venue_id(params[:id])
        @review.score
      else
        "N/A"
      end
    end
  end
  </code></pre>
  
  <p>I'm at a loss for what to try now. I've Googled around and haven't had any luck. How do I fix this?</p>
  
  <p>Edit: My temporary solution - I've removed <code>:remote =&gt; true</code> from the modal and redirected the visitor in the controller action, so now I don't have to worry about it being dismissed. </p>
  
  <p>It's obviously clunky/hacky, so I'd still love it if someone could help me solve this. Willing to provide more code/info on demand.</p>