Class: Decidim::Elections::Trustee
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Elections::Trustee
- Defined in:
- app/models/decidim/elections/trustee.rb
Overview
The data store for a trustee in the Decidim::Elections component. It stores a public key and has a reference to Decidim::User.
Class Method Summary collapse
Instance Method Summary collapse
-
#bulletin_board_slug ⇒ Object
The bulletin_board_slug is used as ‘unique_id` on the Bulletin Board, where the “authority.name” gets added as identification.
- #slug ⇒ Object
Class Method Details
.for(user) ⇒ Object
22 23 24 |
# File 'app/models/decidim/elections/trustee.rb', line 22 def self.for(user) find_by(user:) end |
.log_presenter_class_for(_log) ⇒ Object
18 19 20 |
# File 'app/models/decidim/elections/trustee.rb', line 18 def self.log_presenter_class_for(_log) Decidim::Elections::AdminLog::TrusteePresenter end |
.trustee?(user) ⇒ Boolean
14 15 16 |
# File 'app/models/decidim/elections/trustee.rb', line 14 def self.trustee?(user) exists?(user:) end |
Instance Method Details
#bulletin_board_slug ⇒ Object
The bulletin_board_slug is used as ‘unique_id` on the Bulletin Board, where the “authority.name” gets added as identification. If the organization name would be missing, it could result in an error, when two organizations inside the same “authority” have a trustee with the same name.
34 35 36 |
# File 'app/models/decidim/elections/trustee.rb', line 34 def bulletin_board_slug "#{organization.name.parameterize}-#{slug}" end |
#slug ⇒ Object
26 27 28 |
# File 'app/models/decidim/elections/trustee.rb', line 26 def slug name.parameterize end |