Unverified Commit 69ab1842 by ocarta-l Committed by GitHub

Fix: use klass.table_name instead of guessing from associated models (#847)

Thanks!
parent 78639494
...@@ -846,9 +846,7 @@ module AnnotateModels ...@@ -846,9 +846,7 @@ module AnnotateModels
# Construct the foreign column name in the translations table # Construct the foreign column name in the translations table
# eg. Model: Car, foreign column name: car_id # eg. Model: Car, foreign column name: car_id
foreign_column_name = [ foreign_column_name = [
klass.translation_class.to_s klass.table_name.to_s.singularize,
.gsub('::Translation', '').gsub('::', '_')
.downcase,
'_id' '_id'
].join.to_sym ].join.to_sym
......
...@@ -389,8 +389,8 @@ describe AnnotateModels do ...@@ -389,8 +389,8 @@ describe AnnotateModels do
context 'with Globalize gem' do context 'with Globalize gem' do
let :translation_klass do let :translation_klass do
double('Post::Translation', double('Folder::Post::Translation',
to_s: 'Post::Translation', to_s: 'Folder::Post::Translation',
columns: [ columns: [
mock_column(:id, :integer, limit: 8), mock_column(:id, :integer, limit: 8),
mock_column(:post_id, :integer, limit: 8), mock_column(:post_id, :integer, limit: 8),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment