I created an application for experimenting with HAML and Nitrous.io, but it seems to have a major problem with each loop. My current setup displays the following correct content:
[#<List id: 1, name: "ToM5", telephone: 2357928154, created_at: "2013-09-03 14:58:22", updated_at: "2013-09-03 17:04:54">, #<List id: 2, name: "Tom9 ", telephone: 2345701247, created_at: "2013-09-03 14:59:40", updated_at: "2013-09-03 17:05:00">, #<List id: 3, name: "Test3", telephone: 235821421, created_at: "2013-09-03 15:27:11", updated_at: "2013-09-03 17:05:05">]
My index controller has:
class ListsController < ApplicationController def index @list = List.all end end
In my index view, I have:
%h2 Here they are: = @list.each do |list| .row %span{:class => "id"}= list.id %span{:class => "name"}= list.name %span{:class => "telephone"}= list.telephone %span{:class => "actions"}= link_to "Edit", edit_list_path(list) = link_to "New", new_list_path
HTML output that I get:
<html> <head> ... </head> <body style=""> <h1 class="heading">This is Lists</h1> <div class="wrap"> <h2>Here they are:</h2> <div class="row"> <span class="id">1</span> <span class="name">ToM5</span> <span class="telephone">2357928154</span> <span class="actions"><a href="/lists/1/edit">Edit</a></span> </div> <div class="row"> <span class="id">2</span> <span class="name">Tom9</span> <span class="telephone">2345701247</span> <span class="actions"><a href="/lists/2/edit">Edit</a></span> </div> <div class="row"> <span class="id">3</span> <span class="name">Test3</span> <span class="telephone">235821421</span> <span class="actions"><a href="/lists/3/edit">Edit</a></span> </div> [#<List id: 1, name: "ToM5", telephone: 2357928154, created_at: "2013-09-03 14:58:22", updated_at: "2013-09-03 17:04:54">, #<List id: 2, name: "Tom9 ", telephone: 2345701247, created_at: "2013-09-03 14:59:40", updated_at: "2013-09-03 17:05:00">, #<List id: 3, name: "Test3", telephone: 235821421, created_at: "2013-09-03 15:27:11", updated_at: "2013-09-03 17:05:05">] <a href="/lists/new">New</a> </div> </body></html>
I'm not sure if this is possible linus, since Nitrous.io launches linux configuration? If someone knows how I can get rid of this hash at the end, it will be great!