Models
The models in Decidim are just plain ActiveRecord
models, so you can use all the methods that come with it.
A model class example would be:
# frozen_string_literal: true
# app/models/decidim/my_module/my_resource.rb
module Decidim
module MyModule
class MyResource < Decidim::MyModule::ApplicationRecord
include Decidim::HasComponent
include Decidim::Traceable
include Decidim::Loggable
include Decidim::Authorable
include Decidim::TranslatableResource
end
end
end
Concerns
The concerns are used to share code between models. They are located in app/models/concerns
.
Most commonly used concerns are:
-
Decidim::ActsAsAuthor
-
Decidim::ActsAsTree
-
Decidim::Amendable
-
Decidim::DownloadYourData
-
Decidim::FilterableResource
-
Decidim::Fingerprintable
-
Decidim::FriendlyDates
-
Decidim::HasArea
-
Decidim::HasAttachmentCollections
-
Decidim::HasAttachments
-
Decidim::HasCategory
-
Decidim::HasComponent
-
Decidim::HasPrivateUsers
-
Decidim::HasReference
-
Decidim::HasResourcePermission
-
Decidim::HasUploadValidations
-
Decidim::Loggable
-
Decidim::NewsletterParticipant
-
Decidim::Paddable
-
Decidim::Participable
-
Decidim::ParticipatorySpaceResourceable
-
Decidim::ParticipatorySpaceUser
-
Decidim::Publicable
-
Decidim::Randomable
-
Decidim::RecordEncryptor
-
Decidim::Resourceable
-
Decidim::ScopableParticipatorySpace
-
Decidim::ScopableResource
-
Decidim::Searchable
Module specific concerns
-
Decidim::Comments::Commentable
-
Decidim::Comments::CommentableWithComponent
-
Decidim::Comments::HasAvailabilityAttributes
-
Decidim::Forms::HasQuestionnaire
-
Decidim::Initiatives::HasArea
-
Decidim::Initiatives::InitiativeSlug
-
Decidim::Proposals::CommentableCollaborativeDraft
-
Decidim::Proposals::CommentableProposal
-
Decidim::Proposals::ParticipatoryTextSection
-
Decidim::Proposals::Valuatable
-
Decidim::Templates::Templatable