diff --git a/app/api/chemotion/search_api.rb b/app/api/chemotion/search_api.rb index 1f563153df..2f18f74d3b 100644 --- a/app/api/chemotion/search_api.rb +++ b/app/api/chemotion/search_api.rb @@ -205,15 +205,15 @@ def serialized_result_by_id_for_sample(sample, serialized_scope) serialized = Entities::SampleEntity.represent( sample, detail_levels: detail_levels, - displayed_in_list: true + displayed_in_list: true, ).serializable_hash serialized_scope.push(serialized) end def serialized_result_by_id(element, serialized_scope) + entities = "Entities::#{id_params['model_name'].capitalize}Entity".constantize serialized = - "Entities::#{id_params['model_name'].capitalize}Entity".constantize - .represent(s, displayed_in_list: true).serializable_hash + entities.represent(element, displayed_in_list: true).serializable_hash serialized_scope.push(serialized) end @@ -529,7 +529,7 @@ def elements_by_scope(scope, collection_id = @c_id) end namespace :by_ids do - desc "Return elements by ids" + desc 'Return elements by ids' params do use :search_params end @@ -541,9 +541,10 @@ def elements_by_scope(scope, collection_id = @c_id) post do scope = search_by_ids(@c_id) return unless scope + serialize_result_by_ids( scope, - params[:page] + params[:page], ) end end