Gioele Barabucci wrote:
I have some constants that I need to share in almost all the pieces of my application. So I decided to put them in ApplicationHelper. From what I understand, ApplicationHelper is used to store helpers available to the whole application.
Somehow my models and my views are unable to access the constants defined in ApplicationHelper. My workaround for models is to 'include ApplicationHelper' inside the model declaration. For views I haven't found a working solution aside copy'n'pasting these constants inside the views.
What is the correct way to use ApplicationHelper and make constants available to the entire application?
I had a similar problem, but it was a common function. So in the models I created global.rb:
class Global def self.frog return "Hello world" end end
Then to use it anywhere I enter Global.frog