better scope checking
git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@106 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7master
parent
0965a46461
commit
cc4c59c539
|
@ -2,7 +2,7 @@ class TagImage < ActiveRecord::Base
|
||||||
belongs_to :image
|
belongs_to :image
|
||||||
belongs_to :tagged, :polymorphic => true
|
belongs_to :tagged, :polymorphic => true
|
||||||
validates_presence_of :image_id, :tagged_id, :tagged_type
|
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
|
def self.types_for_select
|
||||||
[ 'Beer', 'People', 'Brewery' ].collect { |x| [x] }
|
[ 'Beer', 'People', 'Brewery' ].collect { |x| [x] }
|
||||||
|
|
Reference in New Issue