unique filenames per album

master
Andrew Coleman 2009-03-21 21:00:41 -05:00
parent 77977e6685
commit ae18d70f66
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ class Photo < ActiveRecord::Base
attr_accessor :file
validates_presence_of :author_id, :album_id
validates_uniqueness_of :filename, :scope => :album_id
belongs_to :album
belongs_to :author
@ -108,4 +109,4 @@ class Photo < ActiveRecord::Base
end
Dir.delete(base_directory)
end
end
end