Answer the question
In order to leave comments, you need to log in
How to properly use and store global constants in Rails?
Hello! As though lamersky a question, do not judge too harshly. Now I declare and use global constants in
app/controllers/application_controller.rb
$ghSavon = { wsdl: Rails.env.production? ?
'http://192.168.1.2:8080/gos_release/ws/createsd.1cws?wsdl' :
'http://192.168.1.2:8080/Gos1_New/ws/Integration/?wsdl',
namespaces: { 'xmlns:ins0' => 'http://www.reality.sh' } }
Answer the question
In order to leave comments, you need to log in
It is more correct to declare a constant (GH_SAVON) rather than a global variable in the so-called initializer. The configuration data itself can be stored in files (the config folder), in yaml or json format, or in any other convenient format.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question