Skip to content

Conversation

@k-duho
Copy link

@k-duho k-duho commented Dec 17, 2025

Summary

Fix NoMethodError: undefined method 'to_yard' when using YARD or RDoc format options.

Closes #212

Problem

When running annotaterb models --format-yard on a model with indexes, foreign keys, or check constraints:

NoMethodError: undefined method 'to_yard' for an instance of
AnnotateRb::ModelAnnotator::IndexAnnotation::Annotation

Solution

Added to_yard and to_rdoc methods to:

  • IndexAnnotation::Annotation
  • ForeignKeyAnnotation::Annotation
  • CheckConstraintAnnotation::Annotation

Related

Test

  • Added unit tests for to_yard and to_rdoc in all three annotation specs

Fix NoMethodError when using YARD or RDoc format with indexes,
foreign keys, or check constraints.

The following Annotation classes were missing to_yard and to_rdoc
methods that are called in annotation_builder.rb:
- IndexAnnotation::Annotation
- ForeignKeyAnnotation::Annotation
- CheckConstraintAnnotation::Annotation

Also adds unit tests for the new methods.

Fixes drwl#212
@k-duho k-duho mentioned this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yard format broken?

1 participant