Sha256: a54175bb27e37687cb3561c9f8e66f607d27487c1217649c1c6dc27de64b3060

Contents?: true

Size: 803 Bytes

Versions: 18

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class InitiativesTypeScope < ApplicationRecord
    belongs_to :type,
               foreign_key: "decidim_initiatives_types_id",
               class_name: "Decidim::InitiativesType",
               inverse_of: :scopes

    belongs_to :scope,
               foreign_key: "decidim_scopes_id",
               class_name: "Decidim::Scope"

    has_many :initiatives,
             foreign_key: "scoped_type_id",
             class_name: "Decidim::Initiative",
             dependent: :restrict_with_error,
             inverse_of: :scoped_type

    validates :scope, uniqueness: { scope: :type }
    validates :supports_required, presence: true
    validates :supports_required, numericality: {
      only_integer: true,
      greater_than: 0
    }
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
decidim-initiatives-0.15.2 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.15.1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.15.0 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.14.4 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.14.3 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.14.2 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.14.1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.13.1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.12.2 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.13.0 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.12.1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.13.0.pre1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.12.0 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.11.2 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.12.0.pre app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.11.1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.11.0.pre1 app/models/decidim/initiatives_type_scope.rb
decidim-initiatives-0.9.1 app/models/decidim/initiatives_type_scope.rb