12

I'm reading the act-as-taggable Github document, https://github.com/mbleigh/acts-as-taggable-on, and I want to force tags to be saved downcase. The instruction in the Configuration section says to add the line

ActsAsTaggableOn.force_lowercase = true

but I'm not quite sure where this would go.

In what file am I supposed to put this piece of code?

Thanks!

Huy
  • 10,806
  • 13
  • 55
  • 99
  • 4
    I guess you can create a file called acts_as_taggable_on_configuration.rb on initializers directory, and place all configuration in it. Remember to restart your application after create this file. – Victor Rodrigues Apr 26 '12 at 02:02
  • I had this error when my gem was too old... for example 2.2.2 gives the error, while 2.3.3 is good! – Eero Jan 28 '13 at 22:40

1 Answers1

13

You can create a custom initializer in config/initializers and put this line there.

Or alternatively, you can set this in config/application.rb:

module YourApp
  class Application < Rails::Application
    ActsAsTaggableOn.force_lowercase = true
  end
end
NARKOZ
  • 27,203
  • 7
  • 68
  • 90