forgeplus/app/forms/contents/update_form.rb

14 lines
375 B
Ruby
Raw Normal View History

2020-03-09 00:40:16 +08:00
class Contents::UpdateForm < BaseForm
2020-03-20 20:15:43 +08:00
attr_accessor :filepath, :branch, :new_branch, :sha
2020-03-09 00:40:16 +08:00
2020-03-20 20:15:43 +08:00
validates :filepath, :sha, 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-05-27 18:25:32 +08:00
# raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
2020-03-09 00:40:16 +08:00
end
end