In certain type of queries (filtering, reporting, etc) it is common have a 
subquery to select from, currently supported with from, and to join into 
subqueries (inline views) which is not supported.

I just ran into said situation which I had to solve by doing the subquery 
as a relationship and calling to_sql and then using the string form of 
joins.

Like:

   subquery = SomeTable
                .scope
                .scope
                .group(:whatever)
                .having("something")
                .to_sql

   OtherTable.joins("INNER JOIN (#{subquery}) PT ON PT.ID = 
other_tables.id")

Would it be possible to implement (or take a PR?) support for this case?

Best regards,

-- 
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 https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to