unique smiles only!
This commit is contained in:
parent
40f54fd19a
commit
49c371302c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue