brianhempel / active_record_union

UNIONs in ActiveRecord! Adds proper union and union_all methods to ActiveRecord::Relation.
Other
423 stars 41 forks source link

Feature request: union relations and SQL strings #18

Closed Jeff-Hostetler closed 5 years ago

Jeff-Hostetler commented 6 years ago

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.

brianhempel commented 6 years ago

Why not:

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