Adding #with to ActiveRecord::Relation

I’d be interested in seeing your patch for this. If you’re not submitting a PR or making it into a gem, can you post a gist of it?

Thanks

Sorry, haven’t gotten around to the gem yet.

Here’s the gist:

I believe it will be slightly different for Rails 4.

Here’s a very contrived example of using it:

Post.with(Arel.sql(‘found as (select id from posts where id in (1,2,3))’)).joins(‘inner join found on found.id = posts.id’)

Something needs to happen with escaping on the found sql, hence the Arel.sql.

Josh