Skip to content

Commit 8b61b6b

Browse files
author
Cuong Tran
committed
Merge branch 'develop'
2 parents 54bdf7e + 5c4a3d0 commit 8b61b6b

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

README.rdoc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The schema comment looks like this:
3333
. . .
3434

3535
It also annotates geometrical columns, geom type and srid, when using
36-
`SpatialAdapter` or `PostgisAdapter`:
36+
`SpatialAdapter`, `PostgisAdapter` or `PostGISAdapter`:
3737

3838
# == Schema Info
3939
#
@@ -119,15 +119,6 @@ anywhere in the file:
119119

120120
# -*- SkipSchemaAnnotations
121121

122-
To generate a configuration file (in the form of a `.rake` file), to set
123-
default options:
124-
125-
rails g annotate:install
126-
127-
Edit this file to control things like output format, where annotations are
128-
added (top or bottom of file), and in which artifacts.
129-
130-
131122
=== Configuration in Rails
132123

133124
To generate a configuration file (in the form of a `.rake` file), to set
@@ -137,6 +128,7 @@ default options:
137128

138129
Edit this file to control things like output format, where annotations are
139130
added (top or bottom of file), and in which artifacts.
131+
140132
== Rails Integration
141133

142134
By default, once you've generated a configuration file, annotate will be
@@ -148,7 +140,7 @@ change:
148140

149141
To:
150142

151-
'skip_on_db_migrate' => "try",
143+
'skip_on_db_migrate' => "true",
152144

153145
If you want to run `rake db:migrate` as a one-off without running annotate,
154146
you can do so with a simple environment variable, instead of editing the
@@ -237,6 +229,7 @@ extra carefully, and consider using one.
237229
- Fabrication: http://github.com/paulelliott/fabrication
238230
- SpatialAdapter: http://github.com/pdeffendol/spatial_adapter
239231
- PostgisAdapter: http://github.com/nofxx/postgis_adapter
232+
- PostGISAdapter: https://github.com/dazuma/activerecord-postgis-adapter
240233

241234

242235
== License
@@ -250,4 +243,5 @@ Released under the same license as Ruby. No Support. No Warranty.
250243

251244
== Authors
252245

253-
{See AUTHORS.rdoc}[link:AUTHORS.rdoc].
246+
{See AUTHORS.rdoc}[link:AUTHORS.rdoc].
247+

lib/annotate/annotate_models.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ def get_schema_info(klass, header, options = {})
121121
col_type = (col.type || col.sql_type).to_s
122122
if col_type == "decimal"
123123
col_type << "(#{col.precision}, #{col.scale})"
124-
else
124+
elsif col_type != "spatial"
125125
if (col.limit)
126126
if col.limit.is_a? Array
127-
attrs << "(#{col.limit.join(', ')})"
127+
attrs << "(#{col.limit.join(', ')})"
128128
else
129129
col_type << "(#{col.limit})" unless NO_LIMIT_COL_TYPES.include?(col_type)
130130
end
@@ -135,6 +135,8 @@ def get_schema_info(klass, header, options = {})
135135
# and print the type and SRID
136136
if col.respond_to?(:geometry_type)
137137
attrs << "#{col.geometry_type}, #{col.srid}"
138+
elsif col.respond_to?(:geometric_type) and col.geometric_type.present?
139+
attrs << "#{col.geometric_type.to_s.downcase}, #{col.srid}"
138140
end
139141

140142
# Check if the column has indices and print "indexed" if true

spec/annotate/annotate_models_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def mock_column(name, type, options={})
103103
# id :integer not null
104104
# name :enum not null, (enum1, enum2)
105105
#
106-
107106
EOS
108107
end
109108

0 commit comments

Comments
 (0)