brianhempel / active_record_union

UNIONs in ActiveRecord! Adds proper union and union_all methods to ActiveRecord::Relation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: union relations and SQL strings

Jeff-Hostetler opened this issue · comments

I recently needed this and thought the project might want something like dis. Idea is for this to work;

User.new(id: 1).posts.union("SELECT * FROM posts WHERE created_at > now()")

I'd be happy to work on it if you think it valuable.

Why not:

User.new(id: 1).posts.union(Post.where("created_at > now()"))