ctran / annotate_models

Annotate Rails classes with schema and routes info
Other
4.41k stars 600 forks source link

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

Open jimmytang opened 5 years ago

jimmytang commented 5 years ago

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

maxh commented 4 years ago

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

MGPalmer commented 3 years ago

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 :(