Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this work if my ApplicationRecord is namespaced? Like
MyFancy::Domain::ApplicationRecord
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure but im sure this is a silly PR as it has such a limited reach.
We need some other way to ignore certain files. Maybe we could have an
.annotate_ignore
file in the project root where we list these?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we don't need much configuration, but it would be nice to ignore conventional stuff like
ApplicationRecord
Also,
So we could replace it with:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but what happens if someone names an actual model application record then we have an issue. I would prefer something like described in #13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how many people actually see this problem
I can tell that my project only has two application records at this moment. Both are called
ApplicationRecord
A simple fix should suffice for a while. Better cover 95% of use cases while we think about custom configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a plan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed that in 560af45. @westonganger @Morozzzko please try
gem 'active_record-annotate', github: '7even/active_record-annotate'
in your apps to confirm it's working.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked:
db:annotte
won't remove themdb:annotate
, the gem won't add themdb:annotate
would override my changes and add the errorWorks well now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's expected behavior - it only touches the files it is going to annotate, and now this process completely ignores abstract classes. You'll have to manually remove old buggy annotations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's alright. Pretty much expected it.
Thanks!