New Line

<% @likes.each do |like| %> <%= like[‘name’] %> <% end %>

Can some one tell me how to use puts here. so that i can get my outputs in a new line format.

<%= %> is puts to the template Engine (in your case ERB). If you want it to match new lines wrap the <%= %> in <p> or wrap the entire enumerator in <pre> which will tell it to read the new lines literally or add <br> to the end of each <%= %>. Adding another puts is not going to affect your bottom line in HTML unless you wrap it in <pre> but the other suggestions are far better probably.

Actually here i want to get the total numbers of likes in a facebook post and the users name who liked the post via some other app. Successfully i can get the data i want. but not in a arranged manner. Here I hv added a screenshot.

My Previous problem solved.

<% @likes.each do |like| %> <%= like['name'] %> <% end %>

Can some one tell me how to use puts here. so that i can get my outputs in a new line format.

<%= %> is puts to the template Engine (in your case ERB). If you want it to match new lines wrap the <%= %> in <p> or wrap the entire enumerator in <pre> which will tell it to read the new lines literally or add <br> to the end of each <%= %>. Adding another puts is not going to affect your bottom line in HTML unless you wrap it in <pre> but the other suggestions are far better probably.

Also you might benefit from working through some HTML tutorials. A good knowledge of HTML is a requirement for web development, even when using Rails.

Colin