This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/models/video_file_lang.rb
2021-08-23 10:26:02 +02:00

24 lines
358 B
Ruby

class VideoFileLang < ApplicationRecord
belongs_to :video_file
belongs_to :lang_site
validates :title, :presence => true
validates :slug, :presence => true, :uniqueness => {:scope => :lang_site_id}
before_validation do
if !self.slug?
self.slug = self.title
end
self.slug = self.slug.to_slug
end
end