title: Bootstrap alert dismissal not working, rails 3.2
body: <p>using twitter bootstrap 2.0 with Rails 3.2 (css files in assets/stylesheets, not using less or sass right now)</p>
  
  <p>I have an bootstrap styled error or success alert at the top of my screen (based on whether first word of message == "Error".
  I've added 'bootstrap.js' &amp; 'bootstrap-alert.js' to the assets/javascript folder.</p>
  
  <p>Here is the code in my layout:</p>
  
  <pre><code>&lt;% flash.each do |name, msg| %&gt;
    &lt;% if msg[0..4] == "Error" %&gt;
      &lt;div class="alert alert-error fade in"&gt;
    &lt;% else %&gt;
      &lt;div class="alert alert-success fade in"&gt;
    &lt;% end %&gt;
    &lt;a class="close" data-dismiss="alert" href="#"&gt;&amp;times;&lt;/a&gt;
    &lt;%= msg %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>In my assets/javascripts/application.js I have:</p>
  
  <pre><code>$(".alert-message").alert()
  $(".alert-message").alert('close')
  </code></pre>
  
  <p>Not sure I need both? tried with .alert / .alert-error as well.</p>
  
  <p>Nothing happens when I click the close symbol, I'm sure I'm missing something very obvious, but I'm new to using JS /w Rails, can't figure this out.
  In the Chrome JS console I see this error message, which seems to be about bootstrap-alert.js data-api:</p>
  
  <p><code>Uncaught TypeError: Object [object Object] has no method 'on'</code> </p>
  
  <p>Many thanks for any tips!</p>