Sha256: 149de02f3648a90f0b433f6ea4621529d4f48dbd3cda047d8fc71fa0e145004b

Contents?: true

Size: 634 Bytes

Versions: 32

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Area types allows to use different types of areas in participatory space
  # (terriotrial, sectorial, etc.)
  class AreaType < ApplicationRecord
    belongs_to :organization,
               foreign_key: "decidim_organization_id",
               class_name: "Decidim::Organization",
               inverse_of: :area_types

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

    validates :name, presence: true

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

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
decidim-core-0.22.0 app/models/decidim/area_type.rb
decidim-core-0.21.0 app/models/decidim/area_type.rb
decidim-core-0.20.1 app/models/decidim/area_type.rb
decidim-core-0.20.0 app/models/decidim/area_type.rb
decidim-core-0.19.1 app/models/decidim/area_type.rb
decidim-core-0.18.1 app/models/decidim/area_type.rb
decidim-core-0.19.0 app/models/decidim/area_type.rb
decidim-core-0.17.2 app/models/decidim/area_type.rb
decidim-core-0.18.0 app/models/decidim/area_type.rb
decidim-core-0.17.1 app/models/decidim/area_type.rb
decidim-core-0.16.1 app/models/decidim/area_type.rb
decidim-core-0.17.0 app/models/decidim/area_type.rb
decidim-core-0.16.0 app/models/decidim/area_type.rb
decidim-core-0.15.2 app/models/decidim/area_type.rb
decidim-core-0.15.1 app/models/decidim/area_type.rb
decidim-core-0.15.0 app/models/decidim/area_type.rb
decidim-core-0.14.4 app/models/decidim/area_type.rb
decidim-core-0.14.3 app/models/decidim/area_type.rb
decidim-core-0.14.2 app/models/decidim/area_type.rb
decidim-core-0.14.1 app/models/decidim/area_type.rb