You need to use the alias method and tell it what to call the alias.
So, you'll want something like this:
service_table = Arel::Table.new(:service)
s1 = service_table.alias("s1")
s2 = service_table.alias("s2")
Take a look at the inner query of this (relevant_contents_query):
https://gist.github.com/22966422d5a62b100d96
Cheers,
Chris
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To post to this group, send email to rails-...@googlegroups.com.
> To unsubscribe from this group, send email to
> rails-oceani...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
I wrote it mostly as an experiment, and found that I couldn't really
use the Arel code to debug the couple of issues that came up. I had to
keep going back to the SQL to get my head around what was going on.
Arel certainly has advantages, but I'd say there are some times when
the costs outweigh them.
Cheers,
Chris