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
d6e4692e
Commit
d6e4692e
authored
Sep 16, 2013
by
Zachary Salzbank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support the PostGIS adapter (
https://github.com/dazuma/activerecord-postgis-adapter
)
parent
aaab884f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
README.rdoc
README.rdoc
+3
-3
annotate_models.rb
lib/annotate/annotate_models.rb
+4
-2
No files found.
README.rdoc
View file @
d6e4692e
...
...
@@ -33,7 +33,7 @@ The schema comment looks like this:
. . .
It also annotates geometrical columns, geom type and srid, when using
`SpatialAdapter`
or `Postgis
Adapter`:
`SpatialAdapter`
, `PostgisAdapter` or `PostGIS
Adapter`:
# == Schema Info
#
...
...
@@ -237,6 +237,7 @@ extra carefully, and consider using one.
- Fabrication: http://github.com/paulelliott/fabrication
- SpatialAdapter: http://github.com/pdeffendol/spatial_adapter
- PostgisAdapter: http://github.com/nofxx/postgis_adapter
- PostGISAdapter: https://github.com/dazuma/activerecord-postgis-adapter
== License
...
...
@@ -250,4 +251,4 @@ Released under the same license as Ruby. No Support. No Warranty.
== Authors
{See AUTHORS.rdoc}[link:AUTHORS.rdoc].
\ No newline at end of file
{See AUTHORS.rdoc}[link:AUTHORS.rdoc].
lib/annotate/annotate_models.rb
View file @
d6e4692e
...
...
@@ -118,10 +118,10 @@ module AnnotateModels
col_type
=
(
col
.
type
||
col
.
sql_type
).
to_s
if
col_type
==
"decimal"
col_type
<<
"(
#{
col
.
precision
}
,
#{
col
.
scale
}
)"
else
elsif
col_type
!=
"spatial"
if
(
col
.
limit
)
if
col
.
limit
.
is_a?
Array
attrs
<<
"(
#{
col
.
limit
.
join
(
', '
)
}
)"
attrs
<<
"(
#{
col
.
limit
.
join
(
', '
)
}
)"
else
col_type
<<
"(
#{
col
.
limit
}
)"
unless
NO_LIMIT_COL_TYPES
.
include?
(
col_type
)
end
...
...
@@ -132,6 +132,8 @@ module AnnotateModels
# and print the type and SRID
if
col
.
respond_to?
(
:geometry_type
)
attrs
<<
"
#{
col
.
geometry_type
}
,
#{
col
.
srid
}
"
elsif
col
.
respond_to?
(
:geometric_type
)
and
col
.
geometric_type
.
present?
attrs
<<
"
#{
col
.
geometric_type
.
to_s
.
downcase
}
,
#{
col
.
srid
}
"
end
# Check if the column has indices and print "indexed" if true
...
...
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