docbrown/app/models/poll_option.rb
rhymes bbf60f8ed2
Remove unused columns from poll options (#7124)
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-04-07 13:15:45 -04:00

17 lines
360 B
Ruby

class PollOption < ApplicationRecord
belongs_to :poll
has_many :poll_votes
validates :markdown, presence: true,
length: { maximum: 128 }
before_save :evaluate_markdown
counter_culture :poll
private
def evaluate_markdown
self.processed_html = MarkdownParser.new(markdown).evaluate_inline_limited_markdown
end
end