Skip to content

Commit

Permalink
only validate doi on create. #110
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Sep 18, 2018
1 parent 26ad107 commit 2518b43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Doi < ActiveRecord::Base
# validates_presence_of :url, if: :is_registered_or_findable?

# from https://www.crossref.org/blog/dois-and-matching-regular-expressions/ but using uppercase
validates_format_of :doi, :with => /\A10\.\d{4,5}\/[-\._;()\/:a-zA-Z0-9]+\z/
validates_format_of :doi, :with => /\A10\.\d{4,5}\/[-\._;()\/:a-zA-Z0-9]+\z/, :on => :create
validates_format_of :url, :with => /\A(ftp|http|https):\/\/[\S]+/ , if: :url?, message: "URL is not valid"
validates_uniqueness_of :doi, message: "This DOI has already been taken"
validates :last_landing_page_status, numericality: { only_integer: true }, if: :last_landing_page_status?
Expand Down

0 comments on commit 2518b43

Please sign in to comment.