Ror error: Undefined method `[]' for nil:Nilclass -> Sitename::Home#index

Asked

Viewed 152 times

1

This application was made through the following Bootstrap template: https://blackrockdigital.github.io/startbootstrap-business-casual/

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

When placing the application in Heroku, the application does not work by presenting the following errors (errors in Carousel):

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>

1 answer

0

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.