Since we've renamed the class to `Option`, having variables, methods and texts refering to it as `answer` was confusing.
16 lines
313 B
Ruby
16 lines
313 B
Ruby
class Polls::Results::QuestionComponent < ApplicationComponent
|
|
attr_reader :question
|
|
|
|
def initialize(question:)
|
|
@question = question
|
|
end
|
|
|
|
def option_styles(option)
|
|
"win" if most_voted_option?(option)
|
|
end
|
|
|
|
def most_voted_option?(option)
|
|
option.id == question.most_voted_option_id
|
|
end
|
|
end
|