gitlink-forgeplus/app/forms/contents/create_form.rb

16 lines
467 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class Contents::CreateForm < BaseForm
attr_accessor :filepath, :branch, :new_branch
validates :filepath, presence: true
validates :new_branch, length: { maximum: 50 }, message: "分支名称过长仅支持50的长度"
validate :check_branch
def check_branch
raise "branch和new_branch必须存在一个 " if branch.blank? && new_branch.blank?
# raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
end
end