class SystemPicture < ActiveRecord::Base
+ has_many :balloons
+ has_many :balloon_templates
+
+ before_destroy :destroy_with_file
+
def validate
errors.add(:filesize, 'size over(1MB)') if self.filesize > 1000000
end
+ def destroy_with_file
+ PictureIO.system_picture_io.delete self.filename
+ end
+
def dext
self.ext.downcase
end