small medium large xlarge

Head_shot_summer09_vladimir_lenin_and_ian_irving_pragsmall
02 Apr 2013, 21:07
Ian Irving (1 post)

you had the partial template to render the line items such that all the line items where on the same line :

<%= sprintf(“%2d x %s”, line_item.quantity, truncate(line_item.product.title, length: 50)) %>

if, instead, in the formatig string you finish with a new line char \n, it looks much better :

<%= sprintf(“%2d x %s\n”, line_item.quantity, truncate(line_item.product.title, length: 50)) %>

this is off of the top of page 183, P3.1

Samr_small_pragsmall
03 Apr 2013, 02:32
Sam Ruby (584 posts)

I’m actually seeing the opposite behavior.

The behavior of <%= %> in erb is to substitute the value in the line, but the linefeed at the end of the line remains, so it works out.

This results in two blank lines after the list of messages, one from the sprintf line and one from the render.

  You must be logged in to comment