    # File lib/active_record/associations.rb, line 616
          def has_one(association_id, options = {})
            reflection = create_has_one_reflection(association_id, options)

            module_eval do
              after_save "association = instance_variable_get(\"@\#{reflection.name}\")\nif !association.nil? && (new_record? || association.new_record? || association[\"\#{reflection.primary_key_name}\"] != id)\nassociation[\"\#{reflection.primary_key_name}\"] = id\nassociation.save(true)\nend\n"
            end

            association_accessor_methods(reflection, HasOneAssociation)
            association_constructor_method(:build,  reflection, HasOneAssociation)
            association_constructor_method(:create, reflection, HasOneAssociation)

            configure_dependency_for_has_one(reflection)

            # deprecated api
            deprecated_has_association_method(reflection.name)
            deprecated_association_comparison_method(reflection.name, reflection.class_name)
          end