Sorry, haven't gotten around to the gem yet. Here's the gist:
https://gist.github.com/joshuap/5727554 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 On Tuesday, May 28, 2013 11:26:58 AM UTC-7, Andrew Kaspick wrote: > > 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 > > > On Thu, May 9, 2013 at 4:52 PM, Joshua Wood <[email protected]<javascript:> > > wrote: > >> Postgres has it: >> http://www.postgresql.org/docs/9.2/static/queries-with.html >> >> Arel has it: >> http://www.ruby-doc.org/gems/docs/a/arel-3.0.2/Arel/SelectManager.html#method-i-with >> >> As far as I can tell, ActiveRecord doesn't. >> >> I did a quick patch this morning for a local 3.2.13 project, and it seems >> to work great. I'd be happy to submit a PR if anyone else wants this (it >> will take a bit more time to do it properly, which is why I'm asking here >> first). >> >> Thanks guys! >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
