Files
nairobi/app/components/admin/poll/questions/answers/table_actions_component.rb
Julian Herrero 14542df0de Allow to delete answers if the poll has not started yet
Deleting answers was not even possible. But it was possible to delete
questions. So we implemented the same behavior.
2022-09-20 17:50:49 +02:00

15 lines
295 B
Ruby

class Admin::Poll::Questions::Answers::TableActionsComponent < ApplicationComponent
attr_reader :answer
delegate :can?, to: :helpers
def initialize(answer)
@answer = answer
end
private
def actions
[:edit, :destroy].select { |action| can?(action, answer) }
end
end