docbrown/app/models/podcast_episode_appearance.rb
yheuhtozr e45536af37
app/models i18n (#16124)
* app/models etc i18n

* delete ja.yml

* fix for PR review

* fix for spec

* delete ja.yml

* fix for spec updated
2022-02-03 13:41:42 -05:00

12 lines
626 B
Ruby

# @note When we destroy the related user, it's using dependent:
# :delete for the relationship. That means no before/after
# destroy callbacks will be called on this object.
class PodcastEpisodeAppearance < ApplicationRecord
belongs_to :user, class_name: "User", inverse_of: :podcast_episode_appearances
belongs_to :podcast_episode
validates :podcast_episode_id, uniqueness: { scope: :user_id }
validates :role, presence: true
validates :role,
inclusion: { in: %w[host guest],
message: I18n.t("models.podcast_episode_appearance.provided_role_is_not_valid") }
end