Recursive inner join example

Is there any example showing recursive inner joins in ROM?
I’m trying the following code:

sort_levels(selector).each.with_index do |(type, value), index|
  if index == 0
    query = query.prefix("level_0").qualified.where("level_0_type" => type.to_s).where("level_0_name" => value)
    query = query.prefix("level_#{index}").qualified.inner_join(:nodes, "level_#{index}_parent_id" => "level_#{index-1}_id")                                          

but I get “table name ‘nodes’ specified more than once”.

Please report it as an issue in rom-sql. A small repro script would be very useful too.