sam1319
sam1319

Reputation: 201

Ruby syntax error in haml file

I am getting the following errors:

app/views/movies/index.html.haml:17: syntax error, unexpected keyword_ensure, expecting keyword_end

app/views/movies/index.html.haml:20: syntax error, unexpected end-of-input, expecting keyword_end

Here is the code that the errors are coming from:

%h1 All Movies
%table#movies  
%thead
    %tr
        %th Movie Title
        %th Rating
        %th Release
        %th More info
    %tbody
    - @movies.each do |movie|
    %tr 
        %td= movie.title
        %td= movie.rating
        %td= movie.release_date
        %td= link_to "More about #{movie.title}",movie_path(movie)

I'm not sure where I need to make changes so these two errors stop popping up.

Upvotes: 0

Views: 201

Answers (1)

Shannon
Shannon

Reputation: 3018

This is a simple fix; indent the lines after - @movies.each do |movie|

 - @movies.each do |movie|
   %tr 
      %td= movie.title
      %td= movie.rating
      %td= movie.release_date
      %td= link_to "More about #{movie.title}",movie_path(movie)

Upvotes: 5

Related Questions