4535: Add default_url_options to application controller that consults
[arvados.git] / services / api / app / controllers / application_controller.rb
index 3465a7832050ff08543e80e9441edd2e60b68c74..762bbd9c1c8bd39cf88ab551eb9221489c5a5455 100644 (file)
@@ -56,6 +56,14 @@ class ApplicationController < ActionController::Base
                 :with => :render_not_found)
   end
 
+  def default_url_options
+    if Rails.configuration.host
+      {:host => Rails.configuration.host}
+    else
+      {}
+    end
+  end
+
   def index
     @objects.uniq!(&:id) if @select.nil? or @select.include? "id"
     if params[:eager] and params[:eager] != '0' and params[:eager] != 0 and params[:eager] != ''
@@ -101,6 +109,7 @@ class ApplicationController < ActionController::Base
             logger.error "params[:ensure_unique_name] is #{params[:ensure_unique_name]}"
             if params[:ensure_unique_name]
               counter += 1
+              @object.uuid = nil
               @object.name = "#{name_stem} (#{counter})"
               retry_save = true
             end