aboutsummaryrefslogblamecommitdiffstats
path: root/lib/arel/engines/sql/core_extensions/array.rb
blob: 412479dc8306cfcbd21d97726577b6ee58a5b2c4 (plain) (tree)
1
2
3
4
5
6
7
8
9



                                 




                                                                    
         
 


                                 



                                 
 

                                
     
   
 
module Arel
  module Sql
    module ArrayExtensions
      def to_sql(formatter = nil)
        if any?
          "(" + collect { |e| e.to_sql(formatter) }.join(', ') + ")"
        else
          "(NULL)"
        end
      end

      def inclusion_predicate_sql
        "IN"
      end
      
      def exclusion_predicate_sql
        "NOT IN"
      end

      Array.send(:include, self)
    end
  end
end