Class: Decidim::Amendment

Inherits:
ApplicationRecord show all
Defined in:
decidim-core/app/models/decidim/amendment.rb

Constant Summary collapse

STATES =
%w(draft evaluating accepted rejected withdrawn).freeze

Instance Method Summary collapse

Instance Method Details

#draft?Boolean

Returns:

  • (Boolean)

14
15
16
# File 'decidim-core/app/models/decidim/amendment.rb', line 14

def draft?
  state == "draft"
end

#evaluating?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'decidim-core/app/models/decidim/amendment.rb', line 18

def evaluating?
  state == "evaluating"
end

#promoted?Boolean

Returns:

  • (Boolean)

26
27
28
29
30
# File 'decidim-core/app/models/decidim/amendment.rb', line 26

def promoted?
  return false unless rejected?

  emendation.linked_promoted_resource.present?
end

#rejected?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'decidim-core/app/models/decidim/amendment.rb', line 22

def rejected?
  state == "rejected"
end