Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created August 1, 2018 16:41
Show Gist options
  • Select an option

  • Save leemcalilly/292f79ce98b65a6aaed43e18b4a41ae1 to your computer and use it in GitHub Desktop.

Select an option

Save leemcalilly/292f79ce98b65a6aaed43e18b4a41ae1 to your computer and use it in GitHub Desktop.

Revisions

  1. leemcalilly created this gist Aug 1, 2018.
    10 changes: 10 additions & 0 deletions artist.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    class Artist < ApplicationRecord
    belongs_to :user

    has_many :spoken_quotes, class_name: "Quote", foreign_key: :speaker_id
    has_many :topic_quotes, class_name: "Quote", foreign_key: :topic_id

    validates :user_id, presence: true
    validates :name, presence: true, length: { maximum: 120 },
    uniqueness: { case_sensitive: false }
    end