7709: Fix ActiveRecord::ImmutableRelation.
authorTom Clegg <tom@curoverse.com>
Mon, 10 Apr 2017 17:07:07 +0000 (13:07 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 10 Apr 2017 17:07:07 +0000 (13:07 -0400)
services/api/app/controllers/application_controller.rb

index 6ba334fc85a7fc489fe5f9fe5be645fdfb2fb2a3..831bcceee7034a72c5ea7bd22720aef035cbcd33 100644 (file)
@@ -83,7 +83,9 @@ class ApplicationController < ActionController::Base
   end
 
   def index
-    @objects.uniq!(&:id) if @select.nil? or @select.include? "id"
+    if @select.nil? || @select.include?("id")
+      @objects = @objects.uniq(&:id)
+    end
     if params[:eager] and params[:eager] != '0' and params[:eager] != 0 and params[:eager] != ''
       @objects.each(&:eager_load_associations)
     end