Prevent nil input to turn into 0

This commit is contained in:
Pau Perez
2020-03-17 19:25:11 +01:00
parent 6ceeda7d9e
commit 38ea95ea85
2 changed files with 2 additions and 3 deletions

View File

@@ -28,8 +28,7 @@ namespace :ofn do
task :truncate, [:months_to_keep] => :environment do |_task, args|
warn_with_confirmation
months_to_keep = args.months_to_keep.to_i
TruncateData.new(months_to_keep).call
TruncateData.new(args.months_to_keep).call
end
def warn_with_confirmation

View File

@@ -8,7 +8,7 @@ class TruncateData
end
def initialize(months_to_keep = nil)
@date = (months_to_keep || 3).months.ago
@date = (months_to_keep || 3).to_i.months.ago
end
def call