Error in RoR: undefined method '[]' for nil: NilClass - NoMethodError in Site :: Home # index

1

This application was made using the following Bootstrap template: link

In my case, after I made all the changes and adaptations, correctly doing the ASSETS and PRE-COMPILE'S, the application ran perfectly on my machine (locally / development).

When placing the application on heroku, the application does not work by apprehending the following errors (carousel errors):

  

NoMethodError in Site :: Home # index Showing   /app/app/views/site/home/_content1.html.erb where line # 16 raised:

     

undefined method '[]' for nil: NilClass Extracted source (around line # 16):

<div class="container">
    <div class="row">
        <div class="box" style="background-color: #E98317;">
            <div class="col-lg-12 text-center">
                <div id="carousel-example-generic" class="carousel slide">
                    <!-- Indicators -->
                    <ol class="carousel-indicators hidden-xs">
                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                    </ol>

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner">
                        <div class="item active" style="height: 600px;">
                            <%= image_tag "img/slide-5.jpg", :class => "img-responsive" %>
                        </div>
                        <div class="item" style="height: 600px;">
                            <%= image_tag "img/slide-4.jpg", :class => "img-responsive" %>
                        </div>
                        <div class="item" style="height: 600px;">
                            <%= image_tag "img/slide-3.jpg", :class => "img-responsive" %>
                        </div>
                    </div>

                    <!-- Controls -->
                    <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                        <span class="icon-prev"></span>
                    </a>
                    <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                        <span class="icon-next"></span>
                    </a>
                </div>
                <div class="box" style="background-color: white;">
                    <h2 class="brand-before">
                        <small>Bem vindo(a) à página da</small>
                    </h2>
                    <h1 class="brand-name">Superar Cursos</h1>
                    <hr class="tagline-divider">
                    <h2>
                        <small>Centro
                            <strong>Profissionalizante</strong>
                        </small>
                    </h2>
                </div>
            </div>
        </div>
    </div>


</div>


<!-- Script to Activate the Carousel -->
<script>

$('.carousel').carousel({
interval: 5000 //changes the speed
})
</script>
    
asked by anonymous 18.07.2017 / 23:51

1 answer

0

Really the template that is giving error is this? because there is no reason to display this type of error since you do not manipulate any variables. Try changing the image_tag tag to the normal html tag and check if the error persists.

    
19.07.2017 / 13:40