pgmodelgen 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tasks/pgmodelgen.rake +11 -0
- metadata +3 -3
data/lib/tasks/pgmodelgen.rake
CHANGED
|
@@ -737,6 +737,17 @@ class PGGen
|
|
|
737
737
|
models[table_name][:constraint] += "\tvalidates_numericality_of :#{row['attribute_name']}, :only_integer => true #{allow_nil} \n"
|
|
738
738
|
end
|
|
739
739
|
end
|
|
740
|
+
|
|
741
|
+
#
|
|
742
|
+
# Add float4 constraint
|
|
743
|
+
#
|
|
744
|
+
models[table_name][:constraint] += "\n"
|
|
745
|
+
result.each do |row|
|
|
746
|
+
if row['type_name'].include? "float4"
|
|
747
|
+
allow_nil = ((row['not_null_constraint'] != 't' or row['has_default_value'] == 't') ? ",:allow_nil => true" : "")
|
|
748
|
+
models[table_name][:constraint] += "\tvalidates_numericality_of :#{row['attribute_name']} #{allow_nil} \n"
|
|
749
|
+
end
|
|
750
|
+
end
|
|
740
751
|
|
|
741
752
|
end
|
|
742
753
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pgmodelgen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.7
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
73
73
|
version: '0'
|
|
74
74
|
segments:
|
|
75
75
|
- 0
|
|
76
|
-
hash:
|
|
76
|
+
hash: 180769016320889054
|
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
none: false
|
|
79
79
|
requirements:
|