Charlie_oscar
Charlie_oscar

Reputation: 57

Rails ActionView::SyntaxErrorInTemplate (Encountered a syntax error while rendering template:)

My rails app runs fine in development. but when I deploy it to production on VPS, the page does not load.

when i load the paige while running a tail on the log

tail -f /var/www/myapp/code/log/production.log

I get below error

INFO -- : [1c740360-49a5-4920-9dfd-47673fbd4eee] Started GET "/" for 27.0.0.1 at 2021-01-04 14:45:11 +0000
INFO -- : [1c740360-49a5-4920-9dfd-47673fbd4eee] Processing by DashboardController#index as HTML
INFO -- : [1c740360-49a5-4920-9dfd-47673fbd4eee]   Rendering dashboard/index.html.erb within layouts/application
INFO -- : [1c740360-49a5-4920-9dfd-47673fbd4eee]   Rendered dashboard/index.html.erb within layouts/application (Duration: 1.0ms | Allocations: 394)
INFO -- : [1c740360-49a5-4920-9dfd-47673fbd4eee] Completed 500 Internal Server Error in 3ms (Allocations: 710)
FATAL -- : [1c740360-49a5-4920-9dfd-47673fbd4eee] ActionView::SyntaxErrorInTemplate (Encountered a syntax error while rendering template: check

Rails points me to the code for app/view/dashboard/index.html.erb which is shown below.

    <br><br><br><br><br>

<section>

<div class="block center-text">
  <header class="header-group">
    <h3>Welcome to Igbo Progressive Union, Connecting Igbo's, around the world.</h3>
  </header>
  <div class="row">
    <div class="col-md-12">
    </div>
  </div>
</div>
</section>
<%= flash_messages %>

<section id="welcome">
    <!-- ======= Top banner ======= -->
  <div  class="jumbotron img-centre">
    <div background: url("../images/welcomeimage.jpeg") >
      
      
      <p>
        <br><br><br><br><br><br><br><br>
        <a class="btn btn-primary btn-lg" href="#about">Learn more</a>
      </p>
    </div>
  </div>
</section>
  

<section id="about">
  <div class="panel panel-success">
    <div class="panel-heading">
      <h3 class="panel-title">About IPU</h3>
    </div>
    <div class="panel-body">
      <table class="table-responsive">
        <tbody>
          
          <tr>
            <td><a><%= image_tag "ipu_logo1.jpg", width:"auto", height:"200", alt="ipu_logo" %></a></td>
            <td conspan="7">
              <div class="well">
              <p>We promote, protect and defend the interest of our members and their dependants around the world. We strive to create awareness of our culture and roots among ourselves and our children. Furthermore IPU promotes social interaction amongst the members of the community and and our members to enhance good relations between our Igbo community and other communities in Nigeria, United Kingdom, USA and throughout the world.</p>
            </div>

            </td>
            <td><a><%= image_tag("IMG_6240.JPG", width:"auto", height:"200") %></a></td>
          </tr>
        </tbody>
      </table>
        <div class="well">
          <p>Our goal is to continously promote Igbo language and culture (Omenani) everywhere in the world where Igbo's reside. We provide a common platform for Igbo's to engage in conversations concerning our culture and tradition, and share information to promote our ideologies. There are extended benefits for financial members, that include support in times of need, such as bereavement, child birth, hospitalization and many more. You can participate on our platform as a standard member at no extra cost by registering on our home page. If you enjoy what we are doing and want to support us, please make a voluntary contrubition to support our global efforts. However becoming a financial member, makes you eligible for all benefits and support as stated in our Articles of Association (constitution) as may be amended from time to time by the general assembley.</p>
        </div>

    </div>
  </div>
</section>

<section id="objectives">
  <div class="panel panel-info">
    <div class="panel-heading">
      <h3 class="panel-title">Objectives of IPU</h3>
    </div>
    <div class="panel-body">
      <table class="table-responsive">
        <tbody>
          <tr>
            <td>
              <ol type="1">
                <li>To promote brotherhood, friendship and unity amongst the Igbo community living in Northamptonshire, the United Kingdom, Nigeria, and throughout the world as well as integrating with other communities.</li>
                <li>To support the welfare of IPU members whether that be morally, financially or otherwise in causes which in the opinion of the General Meeting merit the support of members.</li>
                <li>To promote and create awareness of the Igbo Language and culture within Northamptonshire and the United Kingdom in general through cultural events, festivals, seminars, and speaking Igbo.</li>
                <li>To organise lectures and educational trips about Igbo language, culture and heritage to the children of IPU members.</li>
                <li>In accordance with Igbo tradition to observe “OMENANI” where appropriate to do so.</li>
              </ol>
            </td>
            <td><a><%= image_tag("IMG_66131.JPG", width:"auto", height:"200") %></a></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</section>

<section id="contact">
  <div class="panel panel-primary">
    <div class="panel-heading">
      <h3 class="panel-title">Contact Us</h3>
    </div>
    <div class="panel-body">
      <table class="table-responsive">
        <tbody>
            <tr>
              <td><%= image_tag("IMG_62471.JPG", width:"auto", height:"200") %></td>
            <td>
              <p>Pastor  </p>
                <p>Phone: +44</p>
              <br>
              <p>Barr </p>
                <p>Phone: +44</p>
              <br>
              <p>Gideon </p>
                <p>Phone: +44</p>
              <br>
              <p>Chidi  </p>
                <p>Phone: +44</p>
                <br>
              <p>Kingsley </p>
                <p>Phone: +44</p>
            </td>
          </tr>
        </tbody>
      </table>
  </div>
</div>
</section>

My trouble is that I cannot find any syntax errors. finally to top it off below errors are thrown out.

[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:42: syntax error, unexpected ')', expecting =>
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:121: syntax error, unexpected `end', expecting ')'
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:42: syntax error, unexpected ')', expecting =>
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:121: syntax error, unexpected `end', expecting ')'
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:42: syntax error, unexpected ')', expecting =>
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:121: syntax error, unexpected `end', expecting ')'
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:42: syntax error, unexpected ')', expecting =>
[7897e223-644d-47ba-bc0c-1eb65772a76d] app/views/dashboard/index.html.erb:121: syntax error, unexpected `end', expecting ')'

however, i don't even have any line 121 in app/views/dashboard/index.html.erb:121 as the code finishes before that at line 119.

How can I find this syntax error?. any and all ideas will be welcome. my production server config is shown below

Ubuntu 20.04 Ruby 2.7.2 with RVM rvm 1.29.11 Webserver : Passenger NGINX Database : Mysql 8.0

Upvotes: 0

Views: 2040

Answers (1)

Matt
Matt

Reputation: 20796

It is just a minor typo:

<%= image_tag "ipu_logo1.jpg", width:"auto", height:"200", alt="ipu_logo" %>

Replace alt= with alt:.

Upvotes: 1

Related Questions