Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
andresag4 committed Jul 22, 2024
1 parent 0ff00fa commit cfe5cea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
# index_profiles_on_uuid (uuid) UNIQUE
#
class Profile < ApplicationRecord
UUID_REGEX = /[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/
UUID_REGEX = /\A[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\z/

belongs_to :profileable, polymorphic: true

has_one :self_ref, class_name: "Profile", foreign_key: :id, inverse_of: :self_ref, dependent: :destroy
has_one :user, through: :self_ref, source: :profileable, source_type: "User"
has_one :speaker, through: :self_ref, source: :profileable, source_type: "Speaker"

validates :uuid, uniqueness: true, presence: true, format: {with: UUID_REGEX}
validates :uuid, uniqueness: true, format: {with: UUID_REGEX}

before_validation :set_uuid

Expand Down

0 comments on commit cfe5cea

Please sign in to comment.