title: Modify database entries on mouseover
body: <p>I'm having a go at creating a notification system for my Rails web app. The header of the site has a bell icon that'll have a red bubble pop up if you have new notifications and clicking on the bell gives you a list of all your most recent notifications. </p>
  
  <p>What I'd like though is to update the notifications 'dismissed' boolean value in the database from false to true when it is hovered over with the mouse. I'm guessing some kind of AJAX/JS could be used but I'm not very confident with those languages so some assistance would be great!</p>
  
  <pre><code>#The template for the header
  &lt;li class="notify"&gt;
   &lt;i class="fa fa-calendar-o"&gt;&lt;/i&gt;
   &lt;i class="fa fa-bell-o" id="notificationmenu" data-toggle="dropdown"&gt;&lt;/i&gt;
     &lt;% if @newnotifications &gt; 0 %&gt;     
      &lt;div class="notification-bubble"&gt; &lt;%= @newnotifications %&gt; &lt;/div&gt;       
     &lt;% end %&gt; 
     &lt;ul class="dropdown dropdown-menu-right dropdown-menu" role="menu" aria-Labelledby="notificationmenu"&gt;
      &lt;% current_user.notifications.where("appear_at &lt; ?", Time.now).order(appear_at: :desc).limit(4).each do |n| %&gt;
        &lt;li&gt;&lt;div class="notification"&gt;
            &lt;div class="row"&gt;
            &lt;div class="col-md-3"&gt;&lt;%= n.image %&gt;&lt;/div&gt;
            &lt;div class="col-md-9"&gt;&lt;%= n.content %&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;/div&gt;&lt;/li&gt;
        &lt;% end %&gt;
  
     &lt;/ul&gt;
    &lt;/li&gt;
  </code></pre>