osem-fcy/app/models/subscription.rb
Emanuel Hayford e5587d42a2 Enable Rails/Validation Rubocop cop
Cop checks for the use of old-style attribute validation. Supports autocorrection which was run
to fix the files concerned

Closes #1414
2017-03-28 21:47:31 +02:00

9 lines
349 B
Ruby

class Subscription < ActiveRecord::Base
validates :user_id, uniqueness: { scope: [:conference_id] }
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