I’m new to Rails and I’m trying to understand a basic concept.
I would like to create a class that inclues only static variables of strings, where I can call them from a controller when I want to. I wanted to achieve this by creating a strings folder under app directory. Later on I’ve created a class called String
class Strings
@testString="this is my test string"
end
Later on I fail when I try to call it from a controller’s index (but I don’t think the function or the controller would matter. Why I cannot reach it? Do I have to apply def self.testString all the time?
I would create them as methods or constants:
Using them: Strings.test_strings or Strings::TESTCONST