add /collections html view, dry up CollectionsController
[arvados.git] / app / controllers / orvos / v1 / metadata_controller.rb
1 class Orvos::V1::MetadataController < ApplicationController
2   def index
3     if params[:target_kind] and params[:target_uuid]
4       @objects = Metadatum.where('target_kind=? and target_uuid=?',
5                                  params[:target_kind], params[:target_uuid])
6     end
7     super
8   end
9
10   def create
11     @m = params[:metadatum]
12     if params[:metadatum].class == String
13       @m = uncamelcase_hash_keys(JSON.parse params[:metadatum])
14     end
15     @m = Metadatum.new @m
16     respond_to do |format|
17       if @m.save
18         format.html { redirect_to @m, notice: 'Metadatum was successfully created.' }
19         format.json { render json: @m, status: :created, location: @m }
20       else
21         format.html { render action: "new" }
22         format.json { render json: @m.errors, status: :unprocessable_entity }
23       end
24     end
25   end
26
27 end