Skip to content
This repository was archived by the owner on Oct 16, 2018. It is now read-only.

jobteaser/active_record_or_scope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActiveRecordOrScope

Build Status Code Climate

This gem allows chaining ActiveRecord scopes with OR instead of the default AND

The implementation is stolen from https://coderwall.com/p/lsdnsw/chain-rails-scopes-with-or

Installation

Add this line to your application's Gemfile:

gem 'active_record_or_scope'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_record_or_scope

Usage

users = User.where_any(
  User.where(name: "Bob"),
  User.where(name: "Bobby"),
  User.where(name: "Bobbie")
)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jobteaser/active_record_or_scope.

About

Allow chaining active record scopes with OR

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors