esjd
July 30, 2010, 2:40am
1
I’m trying to render a list of div’s with ids “item1”, “item2”, “item3”,
etc…
Trying to do it like this:
<% for i in [email protected] %>
.. blah blah ..
<% end %>
Pretty sure the syntax is wrong. I couldn’t find the answer after
googling for a bit - perhaps I’m too new and dont know where to look.
Help please?
esjd
July 30, 2010, 4:49am
2
<% @items.each do |item| %>
<% end %>
I think it goes model.method action |table| tuple.relvar.
I took the logic from here
Ruby on Rails,Rails Tutorial,Ruby Basics,Rails 4,Bar Rails,Rail
http://guides.rails.info/getting_started.html#rest and applied the
solution
for post to your problem.
I’m a newbian refuge as well.
esjd
July 30, 2010, 10:02am
3
On 30 July 2010 01:40, Eddie Du [email protected] wrote:
<% end %>
Pretty sure the syntax is wrong. I couldn’t find the answer after
googling for a bit - perhaps I’m too new and dont know where to look.
What is the problem that you see?
Colin
esjd
July 30, 2010, 10:26am
4
On 30 July 2010 03:48, Angel Robert M. [email protected]
wrote:
<% @items.each do |item| %>
<% end %>
I’m trying to render a list of div’s with ids “item1”, “item2”, “item3”,
If you’re specifically after “item1” rather than “item<item.id>”, then
you can use “each_with_index”:
<% @items.each_with_index do |item, index| %>
<%= item.record-name %>
<% end %>
esjd
July 30, 2010, 5:16pm
5
I realized I just typed the quotes wrong. Sorry!
Though thanks for the replies, especially @angel and @Michael P.,
those are really helpful suggestions.