diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index ac214ffb4..cacf73cad 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -846,9 +846,7 @@ def ignored_translation_table_colums(klass) # Construct the foreign column name in the translations table # eg. Model: Car, foreign column name: car_id foreign_column_name = [ - klass.translation_class.to_s - .gsub('::Translation', '').gsub('::', '_') - .downcase, + klass.table_name.to_s.singularize, '_id' ].join.to_sym diff --git a/spec/lib/annotate/annotate_models_spec.rb b/spec/lib/annotate/annotate_models_spec.rb index 370298f3c..0cab5f55f 100644 --- a/spec/lib/annotate/annotate_models_spec.rb +++ b/spec/lib/annotate/annotate_models_spec.rb @@ -389,8 +389,8 @@ def mock_column(name, type, options = {}) context 'with Globalize gem' do let :translation_klass do - double('Post::Translation', - to_s: 'Post::Translation', + double('Folder::Post::Translation', + to_s: 'Folder::Post::Translation', columns: [ mock_column(:id, :integer, limit: 8), mock_column(:post_id, :integer, limit: 8),