Class: Decidim::ActionDelegator::Delegation

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/action_delegator/delegation.rb

Instance Method Summary collapse

Instance Method Details

#grantee_voted?Boolean

Returns:

  • (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

#userObject

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