Skip to content

Commit

Permalink
enable related_items database column
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 5, 2021
1 parent 54324bf commit 5e8f4f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/controllers/datacite_dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ def safe_params
dates
identifiers
relatedIdentifiers
relatedItems
fundingReferences
geoLocations
rightsList
Expand Down
15 changes: 8 additions & 7 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Doi < ApplicationRecord
validate :check_landing_page, if: :landing_page?
validate :check_identifiers, if: :identifiers?
validate :check_related_identifiers, if: :related_identifiers?
# validate :check_related_items, if: :related_items?
validate :check_related_items, if: :related_items?
validate :check_funding_references, if: :funding_references?
validate :check_geo_locations, if: :geo_locations?
validate :check_language, if: :language?
Expand Down Expand Up @@ -1656,13 +1656,14 @@ def identifier
normalize_doi(doi, sandbox: !Rails.env.production?)
end

def related_items=(value)
write_attribute(:related_items, value) if has_attribute?(:related_items)
end
# disable virtual attributes, as database has been migrated
# def related_items=(value)
# write_attribute(:related_items, value) if has_attribute?(:related_items)
# end

def related_items
read_attribute(:related_items) if has_attribute?(:related_items)
end
# def related_items
# read_attribute(:related_items) if has_attribute?(:related_items)
# end

def client_id
client.symbol.downcase if client.present?
Expand Down

0 comments on commit 5e8f4f5

Please sign in to comment.