add create method. refs #1406
[arvados.git] / app / controllers / application_controller.rb
index 86bebcd103d1da8a00f9540f3c7f12e9c73f2504..b9d9743bdb059744ba3d1c45471f592c650ebada 100644 (file)
@@ -131,8 +131,8 @@ class ApplicationController < ActionController::Base
     if @attrs.is_a? String
       @attrs = uncamelcase_hash_keys(Oj.load @attrs)
     end
-    if @attrs.nil?
-      raise "no #{resource_name} (or #{resource_name.camelcase(:lower)}) provided with request #{params.inspect}"
+    unless @attrs.is_a? Hash
+      raise "no #{resource_name} (or #{resource_name.camelcase(:lower)}) hash provided with request #{params.inspect}"
     end
     %w(created_at modified_by_client modified_by_user modified_at).each do |x|
       @attrs.delete x
@@ -183,7 +183,7 @@ class ApplicationController < ActionController::Base
       Thread.current[:api_client_trusted] = session[:api_client_trusted]
       Thread.current[:api_client_ip_address] = remote_ip
       Thread.current[:api_client_authorization] = api_client_auth
-      Thread.current[:api_client_uuid] = api_client.uuid
+      Thread.current[:api_client_uuid] = api_client && api_client.uuid
       Thread.current[:api_client] = api_client
       Thread.current[:user] = user
       yield