Created
January 20, 2016 17:21
-
-
Save elrayle/949b278782fa2ca25ca5 to your computer and use it in GitHub Desktop.
Allocate object from object_profile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def allocate_object | |
| active_fedora_class.allocate.init_with_json(profile_json) do |allocated_object| | |
| create_key = allocated_object.indexing_service.class.create_time_solr_name | |
| modified_key = allocated_object.indexing_service.class.modified_time_solr_name | |
| allocated_object.resource.set_value(:create_date, DateTime.parse(solr_doc[create_key])) if solr_doc[create_key] | |
| allocated_object.resource.set_value(:modified_date, DateTime.parse(solr_doc[modified_key])) if solr_doc[modified_key] | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From active_fedora gem /lib/active_fedora/solr_instance_loader.rb
profile_json = the json from the object_profile field in the solr doc