tabletop-companion/app/models/dice_roll.rb

14 lines
349 B
Ruby
Raw Normal View History

2024-06-13 07:41:45 +00:00
# frozen_string_literal: true
class DiceRoll < ApplicationRecord
belongs_to :rollable, polymorphic: true
belongs_to :table
validates :result, presence: true,
numericality: { only_integer: true }
2024-06-13 12:24:54 +00:00
def display_text
"#{rollable.character.name} rolled #{rollable.name}: <strong>#{result}</strong>".html_safe
end
2024-06-13 07:41:45 +00:00
end