title: How to Loop thru images on a Rails Table
body: <p>I am attempting to loop thru images for a game in a full rails application.  I have a table set up with information about each game, however when I attempt to do images I can only get one image to show on all the games instead of just iterating over each image in my image file to show the correct image against the correct game.
  My images are currently stored in the public folder in my App...</p>
  <pre><code>.../Diverge/public/images
  </code></pre>
  <p>My current table ...</p>
  <pre><code>  &lt;tbody&gt;
      &lt;% @games.each do |game| %&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;%= game.name %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= game.released %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= game.game_studio.name %&gt;&lt;/td&gt;
          &lt;td&gt; &lt;%= image_tag(&quot;/images/wc3.jpg&quot;, :size=&gt; &quot;300x200&quot;) &lt;/td&gt; 
          &lt;td&gt;&lt;%= link_to 'Show', game %&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;% end %&gt;
    &lt;/tbody&gt;
  </code></pre>
  <p>I attempted to do something like this to iterate over each image in the images folder</p>
  <pre><code>&lt;div class=&quot;container&quot;&gt;
   &lt;div class=&quot;images&quot;&gt;
    &lt;% @images.each do |image| %&gt;
      &lt;%= image_tag image  %&gt;
     &lt;% end %&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>my controller</p>
  <pre><code>class GamesController &lt; ApplicationController
    before_action :set_game, only: [:show, :edit, :update, :destroy]
   
  
    def index
      @games = Game.all
    end
  
  
  
    def show
    end
  
    def new
      @game = current_user.games.build
    end
  
    def edit
    end
  
  
    def create
      @game = Game.new(game_params)
  
      respond_to do |format|
        if @game.save
          format.html { redirect_to @game, notice: 'Game was successfully created.' }
          format.json { render :show, status: :created, location: @game }
        else
          format.html { render :new }
          format.json { render json: @game.errors, status: :unprocessable_entity }
        end
      end
    end
  
  
    def update
      respond_to do |format|
        if @game.update(game_params)
          format.html { redirect_to @game, notice: 'Game was successfully updated.' }
          format.json { render :show, status: :ok, location: @game }
        else
          format.html { render :edit }
          format.json { render json: @game.errors, status: :unprocessable_entity }
        end
      end
    end
  
   
    def destroy
      @game.destroy
      respond_to do |format|
        format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }
        format.json { head :no_content }
      end
    end
  
    private
      def set_game
        @game = Game.find(params[:id])
      end
  
      def game_params
        params.require(:game).permit(:name, :released, :game_studio_id, :game_id) 
      end
  end
  </code></pre>
  <p>but nothing is rendering.  Any help is appreciated!</p>