I want to build an index for different objects in my Rails project and would like to add a 'count_occurences' method that I can call on String objects.
I saw I could do something like
class String
  def self.count_occurences
    do_something_here
  end
end
What's the exact way to define this method, and where to put the code in my Rails project?
Thanks
 
     
     
    