a1afd1e7155f748e6282771d928d92321ccb1e56
[arvados.git] / app / controllers / orvos / v1 / collections_controller.rb
1 class Orvos::V1::CollectionsController < ApplicationController
2   def create
3     # It's not an error for a client to re-register a manifest that we
4     # already know about.
5     @object = model_class.new resource_attrs
6     begin
7       @object.save!
8     rescue ActiveRecord::RecordNotUnique
9       logger.debug resource_attrs.inspect
10       if resource_attrs['manifest_text'] and resource_attrs['uuid']
11         @existing_object = model_class.
12           where('uuid=? and manifest_text=?',
13                 resource_attrs['uuid'],
14                 resource_attrs['manifest_text']).
15           first
16         @object = @existing_object || @object
17       end
18     end
19     show
20   end
21 end