photomix/app/models/album.rb
2009-05-22 22:38:52 +02:00

16 lines
543 B
Ruby

class Album < ActiveRecord::Base
has_many :photos, :dependent => :destroy
validates_uniqueness_of :path, :message => "Album already exsists on disc"
before_destroy :destroy_directory
private
def destroy_directory
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
#Dir.delete( APP_CONFIG[:photos_path] + self.path + "/" ) if File.exists?( APP_CONFIG[:photos_path] + self.path )
#Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path )
end
end