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
# 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
......
......@@ -389,8 +389,8 @@ describe AnnotateModels do
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),
......
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