Exchange constant between models

I want a constant to be defined in two models, but I don't want to repeat the code. I put this constant in config/application.rb . Is this a good practice? Is there a better way to do this?

+4
source share
1 answer

The best place to declare application constants would be in the .rb file in the config / initializers folder. Declaring a constant in the initializer (or, as you did in config / application.rb) makes it available in all models / controllers / views in your application.

+4
source

All Articles