19

In rails, when creating an initializer, is it as simple as adding a file to the config/initializer director or do I need to make changes elsewhere?

I'm asking because I keep getting errors every time I create an initializer for gems...and not sure if it's because I'm missing a step in creating initializers.

2 Answers 2

23

initializers are just files in config/initializers there is no other magic

1
  • 3
    when you add a new initializer you'll also need to restart your local server, just a simple browser refresh will not pull in the newly created initializer.
    – Jordan
    Nov 15, 2016 at 21:16
0

If you're using a plugin or gem though, you may need to explicitly "request" or "require" the plugin in your controllers too...in that case, you'll just need to look at the documentation.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.