Sha256: ff7236a0a5f1e308a4d88ab9b6420b06d551f551aabd06a15d37944432ab2834

Contents?: true

Size: 814 Bytes

Versions: 6

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Area types allows to use different types of areas in participatory space
  # (territorial, sectorial, etc.)
  class AreaType < ApplicationRecord
    include Decidim::TranslatableResource
    include Decidim::Traceable

    translatable_fields :name, :plural

    belongs_to :organization,
               foreign_key: "decidim_organization_id",
               class_name: "Decidim::Organization",
               inverse_of: :area_types

    has_many :areas, class_name: "Decidim::Area", inverse_of: :area_type, dependent: :nullify

    validates :name, presence: true

    def translated_name
      Decidim::AreaTypePresenter.new(self).translated_name
    end

    def self.log_presenter_class_for(_log)
      Decidim::AdminLog::AreaTypePresenter
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/models/decidim/area_type.rb
decidim-core-0.29.0 app/models/decidim/area_type.rb
decidim-core-0.29.0.rc4 app/models/decidim/area_type.rb
decidim-core-0.29.0.rc3 app/models/decidim/area_type.rb
decidim-core-0.29.0.rc2 app/models/decidim/area_type.rb
decidim-core-0.29.0.rc1 app/models/decidim/area_type.rb