Fixing Inflections for Acronyms
In my app, there are a list of files that people need to upload. I had set things up so that they could pick the type of file from a dropdown list. The list of files are:
DOC_CLASSES = ["CV", "Research Statement", "List of Publications", "Cover Letter"]
In my form, I use collection_select to display these types in a dropdown list. The option I use is to :titleize them all. The problem is that this makes the option “CV” appear as “Cv”. The solution is to define a new acronym for CV.
In config/initializers/inflections.rb
ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'CV' end
Now, CV appears as CV in the dropdown list.