sam*_*319 0 ruby haml ruby-on-rails
我收到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
以下是错误来自的代码:
%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)
Run Code Online (Sandbox Code Playgroud)
我不确定我需要在哪里进行更改,因此这两个错误不再弹出.
这是一个简单的修复; 之后缩进行- @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)
Run Code Online (Sandbox Code Playgroud)