From ae18d70f66912c23e25f8dd3ad039b428e1bf6be Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Sat, 21 Mar 2009 21:00:41 -0500 Subject: [PATCH] unique filenames per album --- app/models/photo.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/photo.rb b/app/models/photo.rb index 7dca0bc..eb495c9 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -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 \ No newline at end of file +end