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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+5
-1
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+17
-0
No files found.
lib/annotate/annotate_models.rb
View file @
6b705dbf
...
...
@@ -120,7 +120,11 @@ module AnnotateModels
col_type
<<
"(
#{
col
.
precision
}
,
#{
col
.
scale
}
)"
else
if
(
col
.
limit
)
col_type
<<
"(
#{
col
.
limit
}
)"
unless
NO_LIMIT_COL_TYPES
.
include?
(
col_type
)
if
col
.
limit
.
is_a?
Array
attrs
<<
"(
#{
col
.
limit
.
join
(
', '
)
}
)"
else
col_type
<<
"(
#{
col
.
limit
}
)"
unless
NO_LIMIT_COL_TYPES
.
include?
(
col_type
)
end
end
end
...
...
spec/annotate/annotate_models_spec.rb
View file @
6b705dbf
...
...
@@ -91,6 +91,23 @@ EOS
EOS
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
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