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.