Class: Decidim::Amendment

Inherits:
ApplicationRecord show all
Defined in:
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)


13
14
15
# File 'app/models/decidim/amendment.rb', line 13

def draft?
  state == "draft"
end

#evaluating?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/decidim/amendment.rb', line 17

def evaluating?
  state == "evaluating"
end

#promoted?Boolean

Returns:

  • (Boolean)


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

def promoted?
  return false unless rejected?

  emendation.linked_promoted_resource.present?
end

#rejected?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/decidim/amendment.rb', line 21

def rejected?
  state == "rejected"
end