Basic Each Loop Ruby on Rails -


i have created app experiment haml , nitrous.io seem having basic issue each loop. current setup outputting following below 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">] 

in index controller have:

class listscontroller < applicationcontroller   def index     @list = list.all   end end 

in index view have:

%h2 here are:  = @list.each |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 

the html output getting is:

<html> <head>    ...   </head> <body style="">   <h1 class="heading">this lists</h1>   <div class="wrap">      <h2>here 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> [#&lt;list id: 1, name: "tom5", telephone: 2357928154, created_at: "2013-09-03 14:58:22", updated_at: "2013-09-03 17:04:54"&gt;, #&lt;list id: 2, name: "tom9 ", telephone: 2345701247, created_at: "2013-09-03 14:59:40", updated_at: "2013-09-03 17:05:00"&gt;, #&lt;list id: 3, name: "test3", telephone: 235821421, created_at: "2013-09-03 15:27:11", updated_at: "2013-09-03 17:05:05"&gt;] <a href="/lists/new">new</a>    </div>   </body></html> 

i not sure if perhaps linus thing nitrous.io runs linux setup? if knows how can rid of hash @ end great!

your error in line:

= @list.each |list| 

equals evaluation , printing result (which in case object you're iterating over). if replace dash, evaluate expression want.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -