bind (DataMapper::Types::Discriminator)

    # File lib/dm-core/types/discriminator.rb, line 10
          def self.bind(property)
            repository_name = property.repository_name
            model           = property.model

            model.default_scope(repository_name).update(property.name => model.descendants)

            model.class_eval "extend Chainable\n\nextendable do\ndef inherited(model)\nsuper  # setup self.descendants\nset_discriminator_scope_for(model)\nend\n\ndef new(*args, &block)\nif args.size == 1 && args.first.kind_of?(Hash)\ndiscriminator = properties(repository_name).discriminator\nmodel         = discriminator.typecast(args.first[discriminator.name])\n\nif model.kind_of?(Model) && !model.equal?(self)\nreturn model.new(*args, &block)\nend\nend\n\nsuper\nend\n\nprivate\n\ndef set_discriminator_scope_for(model)\nmodel.default_scope(\#{repository_name.inspect}).update(\#{property.name.inspect} => model.descendants)\nend\nend\n", __FILE__, __LINE__ + 1
          end