You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/forms/contents/update_form.rb

14 lines
425 B

5 years ago
class Contents::UpdateForm < BaseForm
attr_accessor :login, :repo_identifier, :filepath, :branch, :new_branch, :sha
validates :login, :repo_identifier, :filepath, :sha, presence: true
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