Introduce a dedicated finder for partial results, reusing the logic of PollOptionFinder. This will be used in rake tasks to avoid code duplication and make the intent clearer.
8 lines
180 B
Ruby
8 lines
180 B
Ruby
class PollPartialResultOptionFinder < PollOptionFinder
|
|
private
|
|
|
|
def existing_choices
|
|
question.partial_results.where(option_id: nil).distinct.pluck(:answer)
|
|
end
|
|
end
|