diff --git a/app/models/fluentd/setting_archive/backup_file.rb b/app/models/fluentd/setting_archive/backup_file.rb index 3b0e2cb..f0c310c 100644 --- a/app/models/fluentd/setting_archive/backup_file.rb +++ b/app/models/fluentd/setting_archive/backup_file.rb @@ -2,15 +2,18 @@ class Fluentd module SettingArchive class BackupFile include Archivable + attr_reader :note FILE_EXTENSION = ".conf".freeze def self.find_by_file_id(backup_dir, file_id) - new(file_path_of(backup_dir, file_id)) + note = Note.find_by_file_id(backup_dir, file_id) rescue nil + new(file_path_of(backup_dir, file_id), note) end - def initialize(file_path) + def initialize(file_path, note = nil) @file_path = file_path + @note = note || Note.new(file_path.sub(/#{FILE_EXTENSION}$/, Note::FILE_EXTENSION)) end end end