docs: def joins(self, table):
          """
          Analog to "INNER JOIN" in SQL on the passed +table+. Use only once
          per query.
          """
  
          def do_join(table, model):
              while model is not associations.model_from_name(table):
                  # ex) Category -> Forum -> Thread -> Post
                  # Category: {"posts": "forums"}
                  # Forum: {"posts": "threads"}
                  # Thread: {"posts": None}
                  # >>> Category.joins("posts")
                  # => [
                  #       {'table': 'forums', 'on': ['category_id', 'id']}
                  #       {'table': 'threads', 'on': ['forum_id', 'id']}
                  #       {'table': 'posts', 'on': ['thread_id', 'id']}
                  #    ]
                  if table in associations.associations_for(model):
                      # This to next: one-many (they have the fk)
                      # If associations.associations_for(model)[table] is None, then this is
                      # terminal (i.e. table is the FINAL association in the
                      # chain)
                      next_level = associations.associations_for(model)[table] or table
                      next_model = associations.model_from_name(next_level)
                      foreign_key = associations.foreign_keys_for(model).get(
                          next_level,
                          inflector.foreignKey(model.__name__))
                      yield {'table': next_level, 'on': [foreign_key, 'id']}
                  else:
                      # One-One or Many-One
                      # singular table had better be in associations.associations_for(model)
                      singular = inflector.singularize(table)
                      next_level = associations.associations_for(model)[singular] or singular
                      next_model = associations.model_from_name(next_level)
                      this_table_name = Repo.table_name(model)
                      foreign_key = associations.foreign_keys_for(model).get(
                          next_level,
                          inflector.foreignKey(model.__name__))
                      if associations.model_has_foreign_key_for_table(table,
                                                                      model):
                          # we have the foreign key
                          order = ['id', foreign_key]
                      else:
                          # They have the foreign key
                          order = [foreign_key, 'id']
                      yield {'table': inflector.pluralize(next_level), 'on': order}
                  model = next_model
  
          self.join_args = list(do_join(table, self.model))
          return self