better scope checking

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@106 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-02-01 05:37:21 +00:00
parent 0965a46461
commit cc4c59c539
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@ class TagImage < ActiveRecord::Base
belongs_to :image
belongs_to :tagged, :polymorphic => true
validates_presence_of :image_id, :tagged_id, :tagged_type
validates_uniqueness_of :tagged_id, :scope => :tagged_type
validates_uniqueness_of :tagged_id, :scope => [ :tagged_type, :image_id ]
def self.types_for_select
[ 'Beer', 'People', 'Brewery' ].collect { |x| [x] }