if params[:filters]
filters = params[:filters]
if filters.is_a? String
- filters = Oj.load filters
+ filters = Oj.safe_load filters
elsif filters.is_a? Array
filters = filters.collect do |filter|
if filter.is_a? String
# Accept filters[]=["foo","=","bar"]
- Oj.load filter
+ Oj.safe_load filter
else
# Accept filters=[["foo","=","bar"]]
filter
@updates.keys.each do |attr|
if @object.send(attr).is_a? Hash
if @updates[attr].is_a? String
- @updates[attr] = Oj.load @updates[attr]
+ @updates[attr] = Oj.safe_load @updates[attr]
end
if params[:merge] || params["merge_#{attr}".to_sym]
# Merge provided Hash with current Hash, instead of
end
end
end
- if @object.update_attributes @updates
+ if @object.update @updates
show
else
self.render_error status: 422
@new_resource_attrs ||= params[model_class.to_s.underscore.singularize]
@new_resource_attrs ||= {}
@object = @object.dup
- @object.update_attributes @new_resource_attrs
+ @object.update @new_resource_attrs
if not @new_resource_attrs[:name] and @object.respond_to? :name
if @object.name and @object.name != ''
@object.name = "Copy of #{@object.name}"
pipelines.results.each { |pi| procs[pi] = pi.created_at }
end
- crs = ContainerRequest.limit(lim).with_count("none").order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]])
+ crs = ContainerRequest.limit(lim).with_count("none").order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]]).select(
+ ["uuid", "name", "container_uuid", "output_uuid", "state", "created_at", "modified_at"])
crs.results.each { |c| procs[c] = c.created_at }
Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim)
# helper method to preload objects for given dataclass and uuids
helper_method :preload_objects_for_dataclass
- def preload_objects_for_dataclass dataclass, uuids, by_attr=nil
+ def preload_objects_for_dataclass dataclass, uuids, by_attr=nil, select_fields=nil
@objects_for ||= {}
raise ArgumentError, 'Argument is not a data class' unless dataclass.is_a? Class
end
else
key_prefix = "request_#{Thread.current.object_id}_#{dataclass.to_s}_"
- dataclass.where(uuid: uuids).each do |obj|
+ dataclass.where(uuid: uuids).select(select_fields).each do |obj|
@objects_for[obj.uuid] = obj
if dataclass == Collection
# The collecions#index defaults to "all attributes except manifest_text"