Ruby on Rails Tuesday, November 24, 2015

Only use <%= for text output

Change <%= on array iterate to <% only

 <%= @categories.each do |category| %>
<% @categories.each do |category| %>

2015-11-24 22:07 GMT-03:00 fugee ohu <fugee279@gmail.com>:
I want my view to print the category names but my browser's displaying an array  first, then the category name Why is it displaying this array I am using acts_as_nested_set in my controller but I don't think that should be the issue

<div>
<table>
  <%= @categories.each do |category| %>
   <tr><td><%= category.name %></td>
  <% end %>
</table>
</div>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/03b275f6-a524-4feb-aafc-bb3460c3cd9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJpK-O-uKUYRXyMs-_OpwCBZOKhw18MdumUcX1O4sxvJ242uQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment