app/models/recommendable/dislike.rb in recommendable-1.1.4 vs app/models/recommendable/dislike.rb in recommendable-1.1.5
- old
+ new
@@ -5,10 +5,13 @@
belongs_to :user, :class_name => Recommendable.user_class.to_s, :foreign_key => :user_id
belongs_to :dislikeable, :polymorphic => true
validates :user_id, :uniqueness => { :scope => [:dislikeable_id, :dislikeable_type],
- :message => "has already disliked this item" }
+ :message => "has already disliked this item" },
+ :presence => true
+ validates_presence_of :dislikeable_id
+ validates_presence_of :dislikeable_type
def dislikeable_type=(sType)
super sType.to_s.classify.constantize.base_class.to_s
end
end