annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

Wrong table annotations for models with same name, but different tables

Open jimmytang opened this issue 5 years ago • 2 comments

Describe your problem here. Two different models, both with the same class name. One is inside a Rails engine inside the app, the other inside the main rails app. They are pointing to different underlying PostGres tables.

When running model annotations, both models show the annotations for the model inside the main app.

The expected result should be the model inside the main app has annotations representing it's underlying table and the model inside the engine has a different set of annotations representing it's underlying table.

Commands

rake db:update_model_annotations

Version

  • annotate version 2.7.5
  • rails version 5.2.3
  • ruby version 2.6.2p47

jimmytang avatar Oct 17 '19 19:10 jimmytang

Looks like a fix for this might be adding an explicit self.table_name = "foo_bar" to one of the models.

maxh avatar Feb 05 '20 17:02 maxh

Looks like a fix for this might be adding an explicit self.table_name = "foo_bar" to one of the models.

We've got the same issue, and this doesn't work for us :(

MGPalmer avatar Mar 24 '21 15:03 MGPalmer