Sunday, December 16, 2012

Re: [Rails] New Line

On Mon, Dec 17, 2012 at 12:49 AM, Samir <samirkanta.dash@indusnet.co.in> wrote:
> <% @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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate