1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-24 17:04:43 +00:00
Files
wrestlingdev.com/app/models/mat_assignment_rule.rb

30 lines
597 B
Ruby

class MatAssignmentRule < ApplicationRecord
belongs_to :mat
belongs_to :tournament
# Convert comma-separated values to arrays
def weight_classes
(super || "").split(",").map(&:to_i)
end
def weight_classes=(value)
super(value.is_a?(Array) ? value.join(",") : value)
end
def bracket_positions
(super || "").split(",")
end
def bracket_positions=(value)
super(value.is_a?(Array) ? value.join(",") : value)
end
def rounds
(super || "").split(",").map(&:to_i)
end
def rounds=(value)
super(value.is_a?(Array) ? value.join(",") : value)
end
end