<% content_for :head dp %>
  <script type='text/javascript'>
    $(document).ready(function () {
      $('#main-image').magnificPopup({
        delegate: 'a',
        type: 'image'
      });
    });
  </script>
<% end %>

<!-- insert_bottom 'head'-->
<% content_for :head dp %>
  <script type='text/javascript'>
    $(document).ready(function () {
      $('#main-image').magnificPopup({
        delegate: 'a',
        type: 'image'
      });
    });
  </script>
<% end %>

Add magnific popup script to head.
Add magnific popup script to head.
