ignore ActiveRecord::AssociatedObject
First, thanks for this up to date version of Annotaterb
I am using the AssociatedObject gem in several project.
Commands
when I run annotaterb I get this warning for the associated objects
Unable to process app/models/school/kind_resolver.rb: undefined method `kind_resolver' for false
This is how the class is defined
class School::KindResolver < ActiveRecord::AssociatedObject
...
end
from what I could see quickly in the code I think it check for the presence of ActiveRecord in the class name. maybe the check could more strict or we could define an exclusion list
Version
- annotaterb version 4.13
- rails version 8.0.1
- ruby version 3.4.1
- database version
- database adapter version (if available) Postgresql
Ok I since then discovered the magic comment to disable schema for a particular file
# -*- SkipSchemaAnnotations
I have a solution, I ll keep the issue open as I think it could be nice to define a more global setting for such cases but feel free to close it
This would be nice to have.
I just ran into the same problem. The comment works but it's a little annoying that in order to migrate to this gem, you have to change all models that inherit from ActiveRecord::AssociatedObject.
Hi @adrienpoly thanks for submitting a detail issue! It helps illustrate the issue.
Do you have a simple Rails app with AssociatedObject gem that I could test with? I don't have any experience with it myself, so some code to test with would be helpful.
I am using it at work (closed source) and on rubyvideo.dev (open source) https://github.com/adrienpoly/rubyvideo.
in Ruby video they are a few Associated Objects:
and some others
the app is fairly simple to start, running bin/rails setup should give you a working app with seeded content (and for now we don't use anymore Meilisearch so no dependencies)
Bump on this. We're trying to move to this gem from annotate so we can upgrade to Rails 8 and the only thing blocking up is this issue with the AssociatedObject gem (which we use heavily)
After some digging I believe this is actually an issue with the ActiveRecord::AssociatedObject gem not actually an issue with annotaterb. I've opened an issue on that repo and will report back if that fixes the issue
We've fixed this in #243, but I've also shipped a fix in Associated Object 0.9.2 via https://github.com/kaspth/active_record-associated_object/issues/40
So this can be closed.
Hello
thanks for working on this. I have tried to upgrade both gems in RubyEvents but I still have a warning message when I run the annotate command. I tried it on another project and I get the same message. Am I missing something?
❯ bundle exec annotaterb models
Annotating models
Unable to process app/models/event/cfp.rb: undefined method 'cfp' for true
Unable to process app/models/event/schedule.rb: undefined method 'schedule' for true
Unable to process app/models/event/static_metadata.rb: undefined method 'static_metadata' for true
Unable to process app/models/organisation/static_metadata.rb: undefined method 'static_metadata' for true
Unable to process app/models/speaker/profiles.rb: undefined method 'profiles' for true
Unable to process app/models/talk/agents.rb: undefined method 'agents' for true
Unable to process app/models/talk/downloader.rb: undefined method 'downloader' for true
Unable to process app/models/talk/thumbnails.rb: undefined method 'thumbnails' for true
Model files unchanged.
I shipped a release on my end that should fix this https://github.com/kaspth/active_record-associated_object/releases/tag/v0.9.3
So there shouldn't be any more need for changes on annotaterb's side.