mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
8 lines
287 B
Ruby
8 lines
287 B
Ruby
class Subscription < ActiveRecord::Base
|
|
belongs_to :conference
|
|
belongs_to :user
|
|
|
|
has_paper_trail on: %i(create destroy), ignore: [:updated_at], meta: { conference_id: :conference_id }
|
|
|
|
validates :user_id, uniqueness: { scope: :conference_id, message: 'already subscribed!' }
|
|
end
|