forked from fixin.me/fixin.me
		
	Merging from main master to my repo master. #4
@ -21,18 +21,15 @@ class Unit < ApplicationRecord
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # add 'portable' fields (import on !default == export) to select
 | 
					    # add 'portable' fields (import on !default == export) to select
 | 
				
			||||||
    with_defaults
 | 
					    with_defaults
 | 
				
			||||||
      .where("NOT EXISTS (?)",
 | 
					      .where.not(
 | 
				
			||||||
             Unit.select(1).from(other_units).joins(
 | 
					        Arel::SelectManager.new.from(other_units)
 | 
				
			||||||
               arel_table.create_join(
 | 
					          .outer_join(other_bases_units)
 | 
				
			||||||
                 other_bases_units,
 | 
					          .on(other_units[:base_id].eq(other_bases_units[:id]))
 | 
				
			||||||
                 arel_table.create_on(other_bases_units[:id].eq(other_units[:base_id])),
 | 
					          .where(
 | 
				
			||||||
                 Arel::Nodes::OuterJoin
 | 
					 | 
				
			||||||
               )
 | 
					 | 
				
			||||||
             ).where(
 | 
					 | 
				
			||||||
            other_bases_units[:symbol].eq(Arel::Table.new(:bases_units)[:symbol])
 | 
					            other_bases_units[:symbol].eq(Arel::Table.new(:bases_units)[:symbol])
 | 
				
			||||||
              .and(other_units[:symbol].eq(arel_table[:symbol]))
 | 
					              .and(other_units[:symbol].eq(arel_table[:symbol]))
 | 
				
			||||||
              .and(other_units[:user_id].not_eq(arel_table[:user_id]))
 | 
					              .and(other_units[:user_id].not_eq(arel_table[:user_id]))
 | 
				
			||||||
             )
 | 
					          ).project(1).exists
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  scope :ordered, ->{
 | 
					  scope :ordered, ->{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user