Skip to content

Commit

Permalink
keep related_items as virtual attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 7, 2021
1 parent 5e8f4f5 commit 62de6f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/controllers/datacite_dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,6 @@ def safe_params
dates
identifiers
relatedIdentifiers
relatedItems
fundingReferences
geoLocations
rightsList
Expand Down
16 changes: 8 additions & 8 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,14 +1656,14 @@ def identifier
normalize_doi(doi, sandbox: !Rails.env.production?)
end

# disable virtual attributes, as database has been migrated
# def related_items=(value)
# write_attribute(:related_items, value) if has_attribute?(:related_items)
# end
# disable virtual attributes when 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 62de6f9

Please sign in to comment.