Rails - How to organize constants

Viewed 116

I am having some constants that I want to define globally in my applications. Also, these constants don't belong to any model. What's the best practice to organize those constants.

Any advice is highly appreciated

1 Answers

simple you can define Module called as example Constants and define it inside the module

module Constants
  CONST1="value"
  CONST2="value2"
end

it's possible also to group them like

 module Constants
  module Group1
    CONST1="value"
    CONST2="value2"
  end
  module Group2
   # some relevant constants 
  end 
end
Related