aboutsummaryrefslogblamecommitdiffstats
path: root/lib/arel/engines/sql/core_extensions/array.rb
blob: 05a1bb774c1cd172efca2edf6d748dfb4f5cde6b (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