mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:43:49 +08:00
58b49bce41
* FEATURE: adds support for initial values through /new-topic to form templates
38 lines
951 B
Ruby
38 lines
951 B
Ruby
# frozen_string_literal: true
|
|
|
|
class FormTemplate < ActiveRecord::Base
|
|
validates :name,
|
|
presence: true,
|
|
uniqueness: true,
|
|
length: {
|
|
maximum: SiteSetting.max_form_template_title_length,
|
|
}
|
|
validates :template,
|
|
presence: true,
|
|
length: {
|
|
maximum: SiteSetting.max_form_template_content_length,
|
|
}
|
|
validates_with FormTemplateYamlValidator
|
|
|
|
has_many :category_form_templates, dependent: :destroy
|
|
has_many :categories, through: :category_form_templates
|
|
|
|
class NotAllowed < StandardError
|
|
end
|
|
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
|
|
#
|