Sha256: 729ff42e7bc2907fa44031430f4d3ab37ff5f83deb499d209bf91cd305e6366d

Contents?: true

Size: 871 Bytes

Versions: 7

Compression:

Stored size: 871 Bytes

Contents

class AwesomeTranslations::CacheDatabaseGenerator::Group < BazaModels::Model
  attr_writer :at_group

  belongs_to :handler, class_name: "AwesomeTranslations::CacheDatabaseGenerator::Handler"

  has_many :handler_translations,
    dependent: :destroy,
    foreign_key: "group_id", # rubocop:disable Rails/RedundantForeignKey
    class_name: "AwesomeTranslations::CacheDatabaseGenerator::HandlerTranslation"

  has_many :translation_keys,
    dependent: :destroy,
    foreign_key: "group_id", # rubocop:disable Rails/RedundantForeignKey
    class_name: "AwesomeTranslations::CacheDatabaseGenerator::TranslationKey"

  validates_presence_of :name, :handler

  def at_handler
    @at_handler ||= handler.at_handler
  end

  def at_group
    @at_group ||= AwesomeTranslations::Group.find_by(handler: at_handler, id: identifier)
  end

  def to_param
    identifier
  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/group.rb
awesome_translations-0.0.65 lib/awesome_translations/cache_database_generator/group.rb
awesome_translations-0.0.64 lib/awesome_translations/cache_database_generator/group.rb
awesome_translations-0.0.63 lib/awesome_translations/cache_database_generator/group.rb
awesome_translations-0.0.62 lib/awesome_translations/cache_database_generator/group.rb
awesome_translations-0.0.61 lib/awesome_translations/cache_database_generator/group.rb
awesome_translations-0.0.60 lib/awesome_translations/cache_database_generator/group.rb