Sha256: 138d3c211655daf4d473665b827ea7e946970d05328359fcc84f68e6522800c5
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 Bytes
Contents
module Wherex module Visitor def self.included base base.class_eval do alias_method_chain :visit_Arel_Nodes_Equality, :wherex alias_method_chain :visit_Arel_Nodes_NotEqual, :wherex end end def visit_Arel_Nodes_Equality_with_wherex *args o = args.first right = o.right if right.present? and right.is_a? Regexp ::ActiveRecord::Base.connection.regexp visit(o.left), visit(right) else visit_Arel_Nodes_Equality_without_wherex *args end end def visit_Arel_Nodes_NotEqual_with_wherex *args o = args.first right = o.right if right.present? and right.is_a? Regexp ::ActiveRecord::Base.connection.regexp_not visit(o.left), visit(right) else visit_Arel_Nodes_NotEqual_without_wherex *args end end def visit_Regexp *args o = args.first ::ActiveRecord::Base.connection.regexp_quote(o.source) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wherex-1.1.1 | lib/wherex/visitor.rb |
wherex-1.1.0 | lib/wherex/visitor.rb |