<commit_before>class GalleryAsset < ActiveRecord::Base
  mount_uploader :image, ImageUploader
  mount_uploader :file, FileUploader

  enum kind: [:video, :image, :file]

  belongs_to :gallery, touch: true

  validates :kind, :gallery, :position, presence: true
  validates :file, presence: true, if: 'kind == "file"'
  validates :image, presence: true, if: 'kind == "image"'
  validates :video_code, presence: true, if: 'kind == "video"'

  before_validation :parse_video_code

  scope :active, ->{ where(active: true) }

  def self.permitted_params
    [:id, :title, :description, :active, :kind, :gallery_id,
     :video_code, :position, :_destroy,<commit_msg>GalleryAsset - Translate title and description<commit_after>class GalleryAsset < ActiveRecord::Base
  mount_uploader :image, ImageUploader
  mount_uploader :file, FileUploader

  enum kind: [:video, :image, :file]

  translates :title, :description

  belongs_to :gallery, touch: true

  validates :kind, :gallery, :position, presence: true
  validates :file, presence: true, if: 'kind == "file"'
  validates :image, presence: true, if: 'kind == "image"'
  validates :video_code, presence: true, if: 'kind == "video"'

  before_validation :parse_video_code

  scope :active, ->{ where(active: true) }

  def self.permitted_params
    [:id, :title, :description, :active, :kind, :gallery_id,
     :video_code, :position, :_destroy,
{'fraction_non_alphanumeric': 0.1336206896551724, 'fraction_numerical': 0.0, 'mean_word_length': 5.191111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6408439', 'n_tokens_mistral': 469, 'n_tokens_neox': 443, 'n_words': 130}