Module: ActiveSupport::Inflector
- Defined in:
- lib/forge/config/initializers/inflections.rb
Overview
Add new inflection rules using the following format (all these examples are active by default): ActiveSupport::Inflector.inflections do |inflect|
inflect.plural /^(ox)$/i, '\1en'
inflect.singular /^(ox)en/i, '\1'
inflect.irregular 'person', 'people'
inflect.uncountable %w( fish sheep )
end
Instance Method Summary collapse
-
#dehumanize(the_string) ⇒ Object
does the opposite of humanize.…
Instance Method Details
#dehumanize(the_string) ⇒ Object
does the opposite of humanize.… mostly. Basically does a space-substituting .underscore
14 15 16 17 |
# File 'lib/forge/config/initializers/inflections.rb', line 14 def dehumanize(the_string) result = the_string.to_s.dup result.downcase.gsub(/ +/,'_') end |