I am trying to capitalize first letter of each word in a string of
words, which is in a given string. I see there is a reference to this
at:

http://www.java2s.com/Code/Ruby/String/Addtwomethodtostringclasstocapitalizefirstletter.htm

which states to add two method to string class to capitalize first
letter


class String
  def capitalize_first_letter
    self[0].chr.capitalize + self[1, size]
  end

  def capitalize_first_letter!
    unless self[0] == (c = self[0,1].upcase[0])
      self[0] = c
      self
    end
  end
end

My question is, if I create this String class -- what is it? Is it a
model? A helper? Where in the world would you put this creature in a
Rails framework? Thanks, Janna
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to