Wednesday, September 3, 2008

Method of the Day: Array#to_sentence

An Oldy but a goody...
  <% a = ['hot dogs', 'hamburgers', 'pizza'] %>
  I like <%= a.to_sentence(:connector => 'and') %>.
  
renders...
  I like hot dogs, hamburgers, and pizza.

No comments: