* Add missing presence validator for Tag * Add missing presence validators to Follow * Add missing presence validators to ProfileField * Add missing presence validators to Comment * Add missing presence validators to Profile * Add missing presence validators to Organization * Add missing presence validators to Badge * Add missing presence validators to Webhook::Endpoint * Add missing presence validators to NotificationSubscription * Add missing presence validators to PodcastEpisode * Add missing presence validators to Sponsorship * Add missing presence validators to PollOption * Add missing presence validators to Poll * Add missing presence validators to Article * Add missing presence validators to EmailAuthorization * Add missing presence validators to AuditLog * Add missing presence validators to DataUpdateScript * Add missing presence validators to User * Add missing presence validators to SiteConfig * Fix specs
17 lines
404 B
Ruby
17 lines
404 B
Ruby
class PollOption < ApplicationRecord
|
|
belongs_to :poll
|
|
has_many :poll_votes, dependent: :destroy
|
|
|
|
validates :markdown, presence: true, length: { maximum: 128 }
|
|
validates :poll_votes_count, presence: true
|
|
|
|
before_save :evaluate_markdown
|
|
|
|
counter_culture :poll
|
|
|
|
private
|
|
|
|
def evaluate_markdown
|
|
self.processed_html = MarkdownParser.new(markdown).evaluate_inline_limited_markdown
|
|
end
|
|
end
|