Closed wkdewey closed 2 years ago
Will mentioned Habeas exhibited this problem on the /search
page.
Habeas code at the time: https://github.com/CDRH/habeascorpus/commit/7733a3465c39f157ca20a35568495212f9f539de
When looking at individual items (I tried on https://github.com/whitmanarchive/whitmanarchive_rails), Orchid turns the item into a hash, which triggers the error undefined method
error' for #
This is due to how Orchid retrieves the items:
def item_retrieve(id)
@res = @items_api.get_item_by_id(id).first # .first turns @res into a hash
Since other code expects @res
to be a hash in the case of an individual item, I moved check_response
out of show
and changed item_retrieve
as follows:
@res = @items_api.get_item_by_id(id)
check_response
@res = @res.first
This code fails if @res is an APIBridge object, with`.
undefined method
key?' for #