Rails: where to put and how to call scheduled clean-up methods <p>I've written a couple of clean-up methods for a Rails app and I'm trying to figure out where the best place to store them is:</p> <pre><code>def flush @documents = Document.ready_to_flush @documents.each do |document| document.update_attributes(generated: false, high_res: nil, low_res: nil) server_url = "#{App::Application.config.server}/tasks/documents/#{document.id}/flush?token=#{App::Application.config.server_token}" response = HTTParty.get(server_url) if response.ok? &amp;&amp; task_id.present? render json: "Assets PDFs for #{document.id}." else render json: "Assets for #{document.id} not flushed." end end end def clear_temporary_directory FileUtils.rm_rf(Dir.glob("#{::Rails.root}/public/temporary/*")) end </code></pre> <p>I'm calling them from <code>schedule.rb</code> (with the <a href="https://github.com/javan/whenever" rel="nofollow">whenever</a> gem) like so:</p> <pre><code>every 1.day, at: '12:17 am' do runner 'clear_temporary_directory', environment: 'production' end every 1.day, at: '12:20 am' do runner 'flush', environment: 'production' end </code></pre> <p>Just not really sure where the best place to store those top methods would be. Are there best practices for it?</p>