Permalink
Browse files

fully ignore array extensions if the key contains a '.'

  • Loading branch information...
1 parent cb52fd1 commit 87ff82ab06df5d1d51581956e788bd94a284a6fe @vrish88 committed May 8, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 ar-extensions/lib/ar-extensions/extensions.rb
@@ -177,11 +177,10 @@ class ArrayExt
NOT_EQUAL_RGX = /(.+)_(ne|not|not_in)/
def self.process( key, val, caller )
- if val.is_a?( Array )
+ if val.is_a?( Array ) && !key.to_s =~ /\./
match_data = key.to_s.match( NOT_EQUAL_RGX )
key = match_data.captures[0] if match_data
- table_name = key.to_s =~ /\./ ? key : caller.quoted_table_name
- str = "#{table_name}.#{caller.connection.quote_column_name( key )} " + (match_data ? 'NOT ' : '') + "IN( ? )"
+ str = "#{caller.quoted_table_name}.#{caller.connection.quote_column_name( key )} " + (match_data ? 'NOT ' : '') + "IN( ? )"
return Result.new( str, val )
end
nil

0 comments on commit 87ff82a

Please sign in to comment.