Files
grecia/app/components/admin/poll/questions/form_component.rb
Javi Martín d18c627392 Add and apply Layout/EmptyLinesAfterModuleInclusion rule
This rule was added in rubocop 1.79. We were inconsistent about it, so
we're adding it to get more consistency.
2025-11-05 14:27:12 +01:00

21 lines
436 B
Ruby

class Admin::Poll::Questions::FormComponent < ApplicationComponent
include TranslatableFormHelper
include GlobalizeHelper
attr_reader :question, :url
use_helpers :can?
def initialize(question, url:)
@question = question
@url = url
end
private
def select_options
Poll.all.select { |poll| can?(:create, Poll::Question.new(poll: poll)) }.map do |poll|
[poll.name, poll.id]
end
end
end