mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-08 06:04:35 +08:00
15 lines
530 B
Ruby
15 lines
530 B
Ruby
# frozen_string_literal: true
|
|
|
|
class FormField < ApplicationRecord
|
|
include Discard::Model
|
|
|
|
belongs_to :form
|
|
belongs_to :created_by, class_name: 'User'
|
|
belongs_to :last_modified_by, class_name: 'User'
|
|
|
|
validates :name, length: { minimum: Constants::NAME_MIN_LENGTH, maximum: Constants::NAME_MAX_LENGTH }
|
|
validates :description, length: { maximum: Constants::NAME_MAX_LENGTH }
|
|
validates :position, presence: true, uniqueness: { scope: :form }
|
|
|
|
acts_as_list scope: :form, top_of_list: 0, sequential_updates: true
|
|
end
|