Sha256: e4d23bd0129cc69fbf28d95ff4b15a02691df6050d1532764e581818a45d5c2d

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

# ActiveRecord::Setops

Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll).
Has only been tested with Rails 5.

# Why?

Joins can be difficult to reason about in Arel (an SQL for that matter). Many joins can be replaced
with set operations which are much simplers beasts and have consistent mathetical properties.

# Installation

Add this line to your application's Gemfile:

```ruby
gem 'activerecord-setops'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install activerecord-setops

# Synopsis

```ruby
class Student < ActiveRecord::Base; end
class Employee < ActiveRecord::Base; end

(Student.select(:name, :birth_date) | Employee.select(:name, :birth_date)).where("name like John%")
```

# See Also

- [Sequel](http://sequel.jeremyevans.net)
- [SQL Set Operations](https://en.wikipedia.org/wiki/Set_operations_(SQL))

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-setops-0.1.0 README.md