20846: Remove deprecated Random::DEFAULT usage.
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index 7481575a6111c437761af84afa802018bfba9d63..e7441df4beecb0bb3f13214a95f61850be40dade 100644 (file)
@@ -152,12 +152,12 @@ class ApplicationController < ActionController::Base
     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
@@ -361,7 +361,7 @@ class ApplicationController < ActionController::Base
     @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
@@ -374,7 +374,7 @@ class ApplicationController < ActionController::Base
         end
       end
     end
-    if @object.update_attributes @updates
+    if @object.update @updates
       show
     else
       self.render_error status: 422
@@ -400,7 +400,7 @@ class ApplicationController < ActionController::Base
     @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}"
@@ -588,7 +588,7 @@ class ApplicationController < ActionController::Base
   def set_current_request_id
     response.headers['X-Request-Id'] =
       Thread.current[:request_id] =
-      "req-" + Random::DEFAULT.rand(2**128).to_s(36)[0..19]
+      "req-" + Random.new.rand(2**128).to_s(36)[0..19]
     yield
     Thread.current[:request_id] = nil
   end