Skip to content

Provide an easy way to use case insensitive `where` in ActiveRecord.

License

Notifications You must be signed in to change notification settings

PikachuEXE/where_lower

Repository files navigation

where_lower

Provide an easy way to use case insensitive where in ActiveRecord.

Status

GitHub Build Status

Gem Version License

Coverage Status Code Climate Inch CI

The above badges are generated by https://shields.io/

Installation

gem 'where_lower'

Usage

Supports String, Array, Range
Values in Array and Range will be converted to String and then downcase
Other types will not be touched

SomeActiveRecordClass.where_lower(attribute1: 'AbC', attribute2: ['stRing', 123, :symBol], attribute3: ('AA'..'AZ'))

Since 0.3.0

You can pass a nested hash (1 level deep only) for association condition

record.association_records.where_lower(association_table: {association_column: value})

You can also add table name in key if you are using it with association
I don't plan to support any "smart" table guessing though

record.association_records.where_lower('association_table.association_column' => value)

Contributors

About

Provide an easy way to use case insensitive `where` in ActiveRecord.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages