Fix user already subscribed exception

Prevent excpetion at user subscription when already is subscribed to a conference and add hanling to the similar unsubscribe event.

remove double validation at app/models/subscription.rb

update subscription_controller_spec
This commit is contained in:
Dimitris 2017-07-15 03:02:03 +03:00 committed by Stella Rouzi
parent 8bd066afbc
commit 2bf7e4bbd3
3 changed files with 8 additions and 7 deletions

View file

@ -1,5 +1,4 @@
class Subscription < ActiveRecord::Base
validates :user_id, uniqueness: { scope: [:conference_id] }
belongs_to :conference
belongs_to :user