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
6b705dbf
Commit
6b705dbf
authored
Feb 14, 2013
by
Mickael Gerard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle array column limits
if column limit is an array, the values are serialilzed into column attr cf enum_column3 gem
parent
8bd159c7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+4
-0
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+17
-0
No files found.
lib/annotate/annotate_models.rb
View file @
6b705dbf
...
@@ -120,9 +120,13 @@ module AnnotateModels
...
@@ -120,9 +120,13 @@ module AnnotateModels
col_type
<<
"(
#{
col
.
precision
}
,
#{
col
.
scale
}
)"
col_type
<<
"(
#{
col
.
precision
}
,
#{
col
.
scale
}
)"
else
else
if
(
col
.
limit
)
if
(
col
.
limit
)
if
col
.
limit
.
is_a?
Array
attrs
<<
"(
#{
col
.
limit
.
join
(
', '
)
}
)"
else
col_type
<<
"(
#{
col
.
limit
}
)"
unless
NO_LIMIT_COL_TYPES
.
include?
(
col_type
)
col_type
<<
"(
#{
col
.
limit
}
)"
unless
NO_LIMIT_COL_TYPES
.
include?
(
col_type
)
end
end
end
end
end
# 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
...
...
spec/annotate/annotate_models_spec.rb
View file @
6b705dbf
...
@@ -91,6 +91,23 @@ EOS
...
@@ -91,6 +91,23 @@ EOS
EOS
EOS
end
end
it
"should get schema info with enum type "
do
klass
=
mock_class
(
:users
,
nil
,
[
mock_column
(
:id
,
:integer
),
mock_column
(
:name
,
:enum
,
:limit
=>
[
:enum1
,
:enum2
])
])
AnnotateModels
.
get_schema_info
(
klass
,
"Schema Info"
).
should
eql
(
<<-
EOS
)
# Schema Info
#
# Table name: users
#
# id :integer not null
# name :enum not null, (enum1, enum2)
#
EOS
end
it
"should get schema info as RDoc"
do
it
"should get schema info as RDoc"
do
klass
=
mock_class
(
:users
,
:id
,
[
klass
=
mock_class
(
:users
,
:id
,
[
...
...
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