Skip to content

Commit

Permalink
support resetting of variables. datacite/bracco#176
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 11, 2019
1 parent bba2e93 commit de5f1ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,8 @@ def safe_params

# merge attributes from xml into regular attributes
# make sure we don't accidentally set any attributes to nil
# set container even if empty, as the content is read-only and generated from other properties
read_attrs_keys.each do |attr|
p.merge!(attr.to_s.underscore => p[attr].presence || meta[attr.to_s.underscore]) if p.has_key?(attr) || meta[attr.to_s.underscore].present? || attr == :container
p.merge!(attr.to_s.underscore => p[attr].presence || meta[attr.to_s.underscore].presence || p[attr]) if p.has_key?(attr) || meta.has_key?(attr.to_s.underscore)
end
p.merge!(version_info: p[:version] || meta["version_info"]) if p.has_key?(:version_info) || meta["version_info"].present?

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,7 @@
patch "/dois/#{doi.doi}", params: update_attributes_again.to_json, headers: headers

expect(json.dig('data', 'attributes', 'descriptions').size).to eq(1)
expect(json.dig('data', 'attributes', 'container')).to be_empty
expect(json.dig('data', 'attributes', 'container')).to be_nil
end
end

Expand Down

0 comments on commit de5f1ec

Please sign in to comment.