I have some rake tasks that run each minute and of course that spawns the environment.rb each time. I’m needing to set a constant that’s dynamically set on server init ONLY at the initial rails server startup, not at every rake task.
How can this be done? How can I ensure that a particular constant is set only at the primary app startup only once and not on other subsequent rake tasks, etc.?
Why dont you just write out your value to a file. If the file already exists, use the value stored inside it, otherwise create the file and write out the contents using something like
Marshal#loadandMarshal#dumpif needed?Just a thought