Using to_sentence method on an Array in Ruby on Rails

       

Member.all.collect {|member| member.firstname}.to_sentence
=> "Alex, Andy, and Sean"

Declare separator and the connector


Member.all.collect {|member| member.firstname}.to_sentence(
  :connector => "and last but not least,", 
  :skip_last_comma => true
)
=> "Alex, Andy and last but not least, Sean"

Tagged w/ #ruby on rails

Apps I've Built

PhotoLocationChanger
Easily change the location on your photos and videos
Click here for more info about the app
PhotoDateChanger
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app