I'm designing a simple photo sharing app and I have an initializer that scans the filesystem for photos to displays and indexes them in a DB.
I want to ensure that this runs exactly once and no more, but the intializers look to be called multiple times. For example, the initializers are called when running db:setup and db:migrate because they both initialize the environment (by requiring the rake task :environment be run), which in turn runs all the initializers. 
Are there any known workarounds?
Thanks!
                        
Store the datetime when you last scanned in a text file OR even better, store it within the database using https://github.com/huacnlee/rails-settings-cached