Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
69ab1842
Unverified
Commit
69ab1842
authored
Jan 31, 2022
by
ocarta-l
Committed by
GitHub
Jan 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: use klass.table_name instead of guessing from associated models (#847)
Thanks!
parent
78639494
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-3
annotate_models_spec.rb
spec/lib/annotate/annotate_models_spec.rb
+2
-2
No files found.
lib/annotate/annotate_models.rb
View file @
69ab1842
...
...
@@ -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
...
...
spec/lib/annotate/annotate_models_spec.rb
View file @
69ab1842
...
...
@@ -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
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment