Module: Marty::Cleaner::TimestampModels
- Defined in:
- app/services/marty/cleaner/timestamp_models.rb
Constant Summary collapse
- LOG_MESSAGE_TYPE =
'timestamp_model_cleaner'
- CLASSES_TO_CLEAN =
[ # Add these to monkey.rb in the format # ::YourApp::YourModelA, # ::YourApp::YourModelB ].freeze
Class Method Summary collapse
Class Method Details
.call(days_to_keep) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/services/marty/cleaner/timestamp_models.rb', line 13 def call(days_to_keep) CLASSES_TO_CLEAN.each do |klass| table_name = klass.table_name ::Marty::Cleaner::CleanAll.log(LOG_MESSAGE_TYPE, table_name) do klass.where( 'updated_at <= ?', Time.zone.now - days_to_keep.days ).delete_all end end end |