I'm trying to get a basic index view to work using HAML instead of HTML, but I'm running into problems.
Here is my index view
%h1
Games
%ul
- @games.each do |game|
%li
= game.title
= game.summary
And I'm getting this error:
syntax error, unexpected keyword_ensure, expecting keyword_end
But I know haml doesn't require you to have end
when you embed ruby on the view, so I'm not sure what the problem is.
Be very careful with indentation in haml
. You need to indent what's inside the each
- @games.each do |game|
%li
= game.title
= game.summary
I would also suggest sticking to 2 spaces as that is pretty much accepted practice in Ruby/Rails.