Ruby haml 文件中的语法错误
Ruby syntax error in haml file
我收到以下错误:
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
错误来自以下代码:
%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)
我不确定我需要在哪里进行更改才能停止弹出这两个错误。
这是一个简单的修复; - @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)
我收到以下错误:
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
错误来自以下代码:
%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)
我不确定我需要在哪里进行更改才能停止弹出这两个错误。
这是一个简单的修复; - @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)