forgeplus/app/forms/contents/create_form.rb

14 lines
363 B
Ruby
Raw Normal View History

2020-03-09 00:40:16 +08:00
class Contents::CreateForm < BaseForm
2020-03-20 20:15:43 +08:00
attr_accessor :filepath, :branch, :new_branch
2020-03-09 00:40:16 +08:00
2020-03-20 20:15:43 +08:00
validates :filepath, presence: true
2020-03-09 00:40:16 +08:00
validate :check_branch
def check_branch
raise "branch和new_branch必须存在一个 " if branch.blank? && new_branch.blank?
2020-03-26 16:50:31 +08:00
# raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
2020-03-09 00:40:16 +08:00
end
end