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
98c182ef
Commit
98c182ef
authored
Jun 16, 2015
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #250 from LcpMarvel/develop
ignore default value for jsonb
parents
be6f088f
a9c0fb62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
annotate_models.rb
lib/annotate/annotate_models.rb
+3
-2
No files found.
lib/annotate/annotate_models.rb
View file @
98c182ef
...
...
@@ -138,12 +138,13 @@ module AnnotateModels
cols
=
cols
.
sort_by
(
&
:name
)
if
(
options
[
:sort
])
cols
=
classified_sort
(
cols
)
if
(
options
[
:classified_sort
])
cols
.
each
do
|
col
|
col_type
=
(
col
.
type
||
col
.
sql_type
).
to_s
attrs
=
[]
attrs
<<
"default(
#{
schema_default
(
klass
,
col
)
}
)"
unless
col
.
default
.
nil?
attrs
<<
"default(
#{
schema_default
(
klass
,
col
)
}
)"
unless
col
.
default
.
nil?
||
col_type
==
"jsonb"
attrs
<<
"not null"
unless
col
.
null
attrs
<<
"primary key"
if
klass
.
primary_key
&&
(
klass
.
primary_key
.
is_a?
(
Array
)
?
klass
.
primary_key
.
collect
{
|
c
|
c
.
to_sym
}.
include?
(
col
.
name
.
to_sym
)
:
col
.
name
.
to_sym
==
klass
.
primary_key
.
to_sym
)
col_type
=
(
col
.
type
||
col
.
sql_type
).
to_s
if
col_type
==
"decimal"
col_type
<<
"(
#{
col
.
precision
}
,
#{
col
.
scale
}
)"
elsif
col_type
!=
"spatial"
...
...
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