You know those adjectives that come after nouns? Well, sometimes you may want to pluralize them correctly in your Rails App. I might have been able to get by with “work_in_processes”, but “bill_of_materialsses” just wasn’t going to cut it.
Here’s the technique I used:
# Add new inflection rules using the following format: ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'BillOfMaterials', 'BillsOfMaterials' inflect.irregular 'bill_of_materials', 'bills_of_materials' inflect.irregular 'WorkInProcess', 'WorksInProcess' inflect.irregular 'work_in_process', 'works_in_process' end
If you have any improvements or suggestions please comment!
Now off to Burger King to order two Whoppers Jr.
One thought on “Pluralizing Post-positive Adjectives in Rails”