unique smiles only!

This commit is contained in:
nilsding 2014-12-28 22:15:25 +01:00
parent 40f54fd19a
commit 49c371302c
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
class Smile < ActiveRecord::Base class Smile < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :answer belongs_to :answer
validates :user_id, presence: true validates :user_id, presence: true, uniqueness: { scope: :answer_id, message: "already smiled answer" }
validates :answer_id, presence: true validates :answer_id, presence: true
after_create do after_create do