# File lib/polyamorous/activerecord_3_and_4.0_ruby_1.9/join_dependency.rb, line 49
    def build_with_polymorphism(
      associations, parent = nil, join_type = InnerJoin
    )
      case associations
      when Join
        parent ||= _join_parts.last
        reflection = parent.reflections[associations.name] or
          raise ::ActiveRecord::ConfigurationError,
            "Association named '#{associations.name
            }' was not found; perhaps you misspelled it?"

        unless join_association = find_join_association_respecting_polymorphism(
          reflection, parent, associations.klass
        )
          @reflections << reflection
          join_association = build_join_association_respecting_polymorphism(
            reflection, parent, associations.klass
          )
          join_association.join_type = associations.type
          _join_parts << join_association
          cache_joined_association(join_association)
        end

        join_association
      else
        build_without_polymorphism(associations, parent, join_type)
      end
    end