just skip the join if it's already there

Remove the annoying `find_or_build` stuff.
expose the root node and call it
speed up match?
hide join_constraints inside the JoinDependency object
add some convenient methods for avoiding array allocations
remove dead code
Merge branch 'tree'

* tree: (22 commits)
  remove dead code
  add some convenient methods for avoiding array allocations
  hide join_constraints inside the JoinDependency object
  speed up match?
  expose the root node and call it
  just skip the join if it's already there
  speed up finding existing nodes
  make node search more efficient
  remove == so we can see where walking up parents occurs
  push parent up to the superclass
  convert JoinBase to a tree and remove the Node class
  names are guaranteed to be symbols
  eliminate function that is only used in one place
  we will always detect the same node, so just pass the node in
  we do not need to to_s the name all the time
  parent is guaranteed to be the same
  reduce number of comparisons and array allocations
  rename the variable to make more sense with a tree
  walk the tree rather than generating a hash and walking it
  do not convert the tree to a list just for the first node
  ...
no need to to_sym
Make valid_options a class method
Make validate_options a class method
Move macro to class level
Move wrap_scope to class level
Merge pull request #12488 from CoryFoy/master

[ci skip] Modifies the initialization guide to make the initializers process clearer
Remove unneeded reader
Extract the scope building to a class method
Remove builder instances

All the job can be done at class level so we can avoid some object
allocation
Method visibility will not make difference here
Merge branch 'builder-instances'
stop creating a bunch of relation objects when we can slap all the joins on at once
Respect `SCRIPT_NAME` when using `redirect` with a relative path

Example:
    # application routes.rb
    mount BlogEngine => '/blog'

    # engine routes.rb
    get '/admin' => redirect('admin/dashboard')

This now redirects to the path `/blog/admin/dashboard`, whereas before it
would've generated an invalid url because there would be no slash between
the host name and the path. It also allows redirects to work where the
application is deployed to a subdirectory of a website.

Fixes #7977