Class: ActiveRecord::Extensions::PostgreSQLRegexp
- Inherits:
-
RegexpBase
- Object
- RegexpBase
- ActiveRecord::Extensions::PostgreSQLRegexp
- Defined in:
- lib/ar-extensions/extensions.rb
Overview
ActiveRecord::Extension for implementing Regexp implementation for PostgreSQL. See documention for RegexpBase.
Note: this doesn’t support case insensitive matches.
Constant Summary
Constants inherited from RegexpBase
RegexpBase::EQUAL_RGX, RegexpBase::NOT_EQUAL_RGX
Class Method Summary collapse
Methods inherited from RegexpBase
Class Method Details
.process(key, val, caller) ⇒ Object
407 408 409 410 411 412 413 |
# File 'lib/ar-extensions/extensions.rb', line 407 def self.process( key, val, caller ) return nil unless val.is_a?( Regexp ) r = field_result( key, caller ) return Result.new((r.negate? \ ? "#{caller.quoted_table_name}.#{r.fieldname} !~ ? OR #{caller.quoted_table_name}.#{r.fieldname} IS NULL" \ : "#{caller.quoted_table_name}.#{r.fieldname} ~ ?"), val ) end |