Mysterious spaces in output

Here is a probably an easy output formatting problem.

I am trying to output a sentence that uses commas between each item
(retailer) and a period once there are no more items.

The problem is, I can't remove the space before my commas in the
output. I've tried putting the html in quotes, but for some reason the
html injects a space between my variable output and the following
text. How can I solve this?

The second problem is my variable count increments correctly, but it
does not trigger the 'else'. Any ideas why?

# the output #

...Write a review on Amazon.com , and GAP , and Limited ,

# the view #

<% for review in @reviews -%>
  <% count += 1 -%>
  <%= link_to review.retailer.name, retailer_path(review) -%>
  <%= if count == @reviews
     ', '
  else
    ', and '
  end -%>
<% end %>

%w(foo bar baz).to_sentence

=> "foo, bar, and baz"

What a nice nugget! Could you enlighten me as to what the %w does?

How could I use a hash with '.to_sentence'. I don't have set
variables, and I don't know how many I'll have.

Xavier, Thanks! You put me on the right path...

This does a beautiful job:

@reviews.collect {|r| r.retailer.name}.to_sentence

It is shorthand for ['foo', 'bar', 'baz'].

FYI, the extra spaces were from the indentation of each line of ERB.

--Matt Jones