Sha256: f3366836094632ce1a3589a21956b1489af58c5be97e82cc2e6be580e90bde55

Contents?: true

Size: 900 Bytes

Versions: 7

Compression:

Stored size: 900 Bytes

Contents

class AwesomeTranslations::CacheDatabaseGenerator::TranslationValue < BazaModels::Model
  belongs_to :translation_key,
    foreign_key: "translation_key_id", # rubocop:disable Rails/RedundantForeignKey
    class_name: "AwesomeTranslations::CacheDatabaseGenerator::TranslationKey"

  validates_presence_of :translation_key

  delegate :key, to: :translation_key

  def calculated_translation_file_path
    "#{handler_translation.dir}/#{locale}.yml" if handler_translation
  end

  def handler_translation
    @handler_translation ||= AwesomeTranslations::CacheDatabaseGenerator::HandlerTranslation
      .find_by(translation_key_id: translation_key_id)
  end

  def migrate_to_awesome_translations_namespace!
    AwesomeTranslations::TranslationMigrator.new(
      translation_key: translation_key,
      handler_translation: handler_translation,
      translation_value: self
    ).execute
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
awesome_translations-0.0.66 lib/awesome_translations/cache_database_generator/translation_value.rb
awesome_translations-0.0.65 lib/awesome_translations/cache_database_generator/translation_value.rb
awesome_translations-0.0.64 lib/awesome_translations/cache_database_generator/translation_value.rb
awesome_translations-0.0.63 lib/awesome_translations/cache_database_generator/translation_value.rb
awesome_translations-0.0.62 lib/awesome_translations/cache_database_generator/translation_value.rb
awesome_translations-0.0.61 lib/awesome_translations/cache_database_generator/translation_value.rb
awesome_translations-0.0.60 lib/awesome_translations/cache_database_generator/translation_value.rb