move some delete and destroy to base

This commit is contained in:
2022-12-22 17:18:28 +02:00
parent fc611ce5c4
commit 034d605d78
4 changed files with 12 additions and 16 deletions

View File

@ -8,6 +8,15 @@ module ActiveYaml
self.class.save_all
end
def delete
self.class.delete(self.id)
end
def destroy
delete
self.class.save_all
end
def self.save_all
data = @records.collect {|obj| obj.attributes}
File.write( self.full_path , data.to_yaml)
@ -20,8 +29,5 @@ module ActiveYaml
true
end
def self.the_private_records
@records
end
end
end