2023-02-08 13:21:39 -06:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class FormTemplate < ActiveRecord::Base
|
|
|
|
validates :name, presence: true, uniqueness: true, length: { maximum: 100 }
|
|
|
|
validates :template, presence: true, length: { maximum: 2000 }
|
|
|
|
validates_with FormTemplateYamlValidator
|
2023-02-23 13:18:14 -06:00
|
|
|
|
|
|
|
has_many :category_form_templates, dependent: :destroy
|
|
|
|
has_many :categories, through: :category_form_templates
|
2023-02-08 13:21:39 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: form_templates
|
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
|
|
|
# name :string(100) not null
|
|
|
|
# template :text not null
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
|
|
|
# index_form_templates_on_name (name) UNIQUE
|
|
|
|
#
|