Class: Decidim::ActionDelegator::Delegation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::ActionDelegator::Delegation
- Defined in:
- app/models/decidim/action_delegator/delegation.rb
Instance Method Summary collapse
- #grantee_voted? ⇒ Boolean
-
#user ⇒ Object
a safe way to get the user that represents the granter in this setting it might not exist if the granter is not in the census.
Instance Method Details
#grantee_voted? ⇒ Boolean
27 28 29 30 31 32 33 34 |
# File 'app/models/decidim/action_delegator/delegation.rb', line 27 def grantee_voted? return false unless grantee && setting @grantee_voted ||= PaperTrail::Version.exists?( whodunnit: grantee.id, object_changes: { decidim_action_delegator_delegation_id: id } ) end |
#user ⇒ Object
a safe way to get the user that represents the granter in this setting it might not exist if the granter is not in the census
38 39 40 |
# File 'app/models/decidim/action_delegator/delegation.rb', line 38 def user @user ||= setting.participants.find_by(decidim_user: granter)&.decidim_user end |