app/models/form.rb
# Creates a new version code/number for the form. Also resets the download count to zero.
Creates a new version code/number for the form. Also resets the download count to zero.
Creates a new version code / number for the form . Also resets the download count to zero .
def increment_version
    raise "standard forms should not be versioned" if standard?
    had_current_version = current_version.present?
    current_version.update!(current: false) if had_current_version
    versions.create!(current: true, minimum: !had_current_version)
    update_columns(downloads: 0, published_changed_at: Time.current)
  end
def increment_version raise "standard forms should not be versioned" if standard? had_current_version = current_version . present? current_version . update! ( current : false ) if had_current_version versions . create! ( current : true , minimum : ! had_current_version ) update_columns ( downloads : 0 , published_changed_at : Time . current ) end
Creates a new version code/number for the form.
Creates a new version code / number for the form .
# Reset downloads since we are only interested in downloads of present version. # Touch last changed so the cache key gets bumped.