Revert "Workaround for Rails 5, where LIMIT..."
This reverts commit 6823e7defb.
Originally implemented in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21839, but an
error was reported in
https://gitlab.com/gitlab-org/gitlab-ce/issues/51729 resulting in a
workaround introduced in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21879.
Now Rails 5.2 is used, this workaround no longer seems needed, so this
reverts it.
			
			
This commit is contained in:
		
							parent
							
								
									1e99c1b0a7
								
							
						
					
					
						commit
						d5080eb5ff
					
				| 
						 | 
				
			
			@ -6,11 +6,7 @@ module Gitlab
 | 
			
		|||
      class << self
 | 
			
		||||
        def self_join(relation)
 | 
			
		||||
          t = relation.arel_table
 | 
			
		||||
          # Work around a bug in Rails 5, where LIMIT causes trouble
 | 
			
		||||
          # See https://gitlab.com/gitlab-org/gitlab-ce/issues/51729
 | 
			
		||||
          r = relation.limit(nil).arel
 | 
			
		||||
          r.take(relation.limit_value) if relation.limit_value
 | 
			
		||||
          t2 = r.as('t2')
 | 
			
		||||
          t2 = relation.arel.as('t2')
 | 
			
		||||
 | 
			
		||||
          relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first)
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue