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
8aa0be75
Commit
8aa0be75
authored
Apr 12, 2015
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #231 from vassilevsky/sql-type-first
Prefer SQL column type over normalized AR type
parents
06f38d84
067ce522
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-1
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+1
-1
No files found.
lib/annotate/annotate_models.rb
View file @
8aa0be75
...
...
@@ -140,7 +140,7 @@ module AnnotateModels
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
col_type
=
(
col
.
sql_type
||
col
.
type
).
to_s
if
col_type
==
"decimal"
col_type
<<
"(
#{
col
.
precision
}
,
#{
col
.
scale
}
)"
elsif
col_type
!=
"spatial"
...
...
spec/annotate/annotate_models_spec.rb
View file @
8aa0be75
...
...
@@ -45,7 +45,7 @@ describe AnnotateModels do
stubs
=
default_options
.
dup
stubs
.
merge!
(
options
)
stubs
.
merge!
(
:name
=>
name
,
:type
=>
type
)
stubs
.
merge!
(
:name
=>
name
,
:
sql_type
=>
type
,
:
type
=>
type
)
double
(
"Column"
,
stubs
)
end
...
...
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