ruby-on-railsinflector

Inflector methods not working in my rails project


I found a method humanize that I want to use in my rails project.

app/views/audits/_show.html.erb

<%= humanize('inappropriate_writing') %>

but I get this error:

undefined method `humanize' for #<#<Class:0x00007fb4f1f98208>:0x00007fb4f39107a8>

Do some rails methods not work out of the box? Am I supposed to "include ActiveSupport::Inflector" somewhere? If so I can't work out where.


Solution

  • You should use humanize method like this "inappropriate_writing".humanize which will give output like Inappropriate writing.