I am currently building a blog in rails , on my portfolio page, I am adding 6 pictures of my projects through the rails admin back end using the paperclip gem. On my portfolio page when I click an image I want a modal to open up showing a slideshow of the project images.
My problem is that when I click any projects image, the modal opens up but only shows the first projects image.
Here is my code `
-# List projects[enter image description here][1] in a reverse order to show last project first.
- @portfolios.reverse.each do |portfolio|
#myModal.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "myModalLabel", :role => "dialog", :tabindex => "-1"}
.modal-dialog{:role => "document"}
.modal-content
.modal-header
%button.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"}
%span{"aria-hidden" => "true"} ×
%h4#myModalLabel.modal-title=portfolio.title
.modal-body
#myCarousel.carousel.slide{"data-ride" => "carousel"}
%ol.carousel-indicators
%li.active{"data-slide-to" => "0", "data-target" => "#myCarousel"}
%li{"data-slide-to" => "1", "data-target" => "#myCarousel"}
%li{"data-slide-to" => "2", "data-target" => "#myCarousel"}
%li{"data-slide-to" => "3", "data-target" => "#myCarousel"}
%li{"data-slide-to" => "4", "data-target" => "#myCarousel"}
%li{"data-slide-to" => "5", "data-target" => "#myCarousel"}
%li{"data-slide-to" => "6", "data-target" => "#myCarousel"}
.carousel-inner{:role => "listbox"}
.item.active
=image_tag portfolio.image1.url(:medium),:class => "style_image img-responsive"
%a.left.carousel-control{"data-slide" => "prev", :href => "#myCarousel", :role => "button"}
%span.glyphicon.glyphicon-chevron-left{"aria-hidden" => "true"}
%span.sr-only Previous
%a.right.carousel-control{"data-slide" => "next", :href => "#myCarousel", :role => "button"}
%span.glyphicon.glyphicon-chevron-right{"aria-hidden" => "true"}
%span.sr-only Next
= portfolio.text
.col-xs-12.col-sm-6.col-md-6
%h3.time=portfolio.title
.image.col-sm-12
%a{"data-target" => "#myModal", "data-toggle" => "modal", :type => "button"}
=image_tag portfolio.image1.url(:medium),:class => "style_image img-responsive"
%p.imgDescription
%i.fa.fa-search.fa-2x{"aria-hidden" => "true"}
.caption
%br
-#Show the fist 350 characters of the article
-#button to show the full article.
%div.tags
%p.tags= raw portfolio.all_tags
`