Sha256: 04a055df3bacbc9c98c9616a415fb079ce77674a4595df2d737763444c895966
Contents?: true
Size: 1.42 KB
Versions: 18
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true module Decidim # Interaction between a user and an organization can be done via an Assembly. # It's a unit of action from the Organization point of view that groups # several features (proposals, debates...) that can be enabled or disabled. class Assembly < ApplicationRecord include Decidim::HasAttachments include Decidim::Participable include Decidim::Publicable include Decidim::Scopable belongs_to :organization, foreign_key: "decidim_organization_id", class_name: "Decidim::Organization" belongs_to :scope, foreign_key: "decidim_scope_id", class_name: "Decidim::Scope", optional: true has_many :categories, foreign_key: "decidim_participatory_space_id", foreign_type: "decidim_participatory_space_type", dependent: :destroy, as: :participatory_space has_many :features, as: :participatory_space validates :slug, presence: true validates :slug, uniqueness: { scope: :organization } mount_uploader :hero_image, Decidim::HeroImageUploader mount_uploader :banner_image, Decidim::BannerImageUploader # Scope to return only the promoted assemblies. # # Returns an ActiveRecord::Relation. def self.promoted where(promoted: true) end def hashtag attributes["hashtag"].to_s.delete("#") end end end
Version data entries
18 entries across 18 versions & 2 rubygems