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
ecf70d8f
Unverified
Commit
ecf70d8f
authored
Feb 02, 2022
by
Hiroki Koike
Committed by
GitHub
Feb 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix undefined method error when geometric columns have no `srid` (#920)
parent
69ab1842
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
annotate_models.rb
lib/annotate/annotate_models.rb
+2
-2
annotate_models_spec.rb
spec/lib/annotate/annotate_models_spec.rb
+5
-1
No files found.
lib/annotate/annotate_models.rb
View file @
ecf70d8f
...
@@ -887,9 +887,9 @@ module AnnotateModels
...
@@ -887,9 +887,9 @@ module AnnotateModels
# Check out if we got a geometric column
# Check out if we got a geometric column
# and print the type and SRID
# and print the type and SRID
if
column
.
respond_to?
(
:geometry_type
)
if
column
.
respond_to?
(
:geometry_type
)
attrs
<<
"
#{
column
.
geometry_type
}
,
#{
column
.
srid
}
"
attrs
<<
[
column
.
geometry_type
,
column
.
try
(
:srid
)].
compact
.
join
(
', '
)
elsif
column
.
respond_to?
(
:geometric_type
)
&&
column
.
geometric_type
.
present?
elsif
column
.
respond_to?
(
:geometric_type
)
&&
column
.
geometric_type
.
present?
attrs
<<
"
#{
column
.
geometric_type
.
to_s
.
downcase
}
,
#{
column
.
srid
}
"
attrs
<<
[
column
.
geometric_type
.
to_s
.
downcase
,
column
.
try
(
:srid
)].
compact
.
join
(
', '
)
end
end
# Check if the column has indices and print "indexed" if true
# Check if the column has indices and print "indexed" if true
...
...
spec/lib/annotate/annotate_models_spec.rb
View file @
ecf70d8f
...
@@ -1168,7 +1168,10 @@ describe AnnotateModels do
...
@@ -1168,7 +1168,10 @@ describe AnnotateModels do
limit:
{
srid:
4326
,
type:
'geometry'
}),
limit:
{
srid:
4326
,
type:
'geometry'
}),
mock_column
(
:location
,
:geography
,
mock_column
(
:location
,
:geography
,
geometric_type:
'Point'
,
srid:
0
,
geometric_type:
'Point'
,
srid:
0
,
limit:
{
srid:
0
,
type:
'geometry'
})
limit:
{
srid:
0
,
type:
'geometry'
}),
mock_column
(
:non_srid
,
:geography
,
geometric_type:
'Point'
,
limit:
{
type:
'geometry'
})
]
]
end
end
...
@@ -1182,6 +1185,7 @@ describe AnnotateModels do
...
@@ -1182,6 +1185,7 @@ describe AnnotateModels do
# active :boolean default(FALSE), not null
# active :boolean default(FALSE), not null
# geometry :geometry not null, geometry, 4326
# geometry :geometry not null, geometry, 4326
# location :geography not null, point, 0
# location :geography not null, point, 0
# non_srid :geography not null, point
#
#
EOS
EOS
end
end
...
...
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