pgmodelgen 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tasks/pgmodelgen.rake +3 -9
- metadata +2 -2
data/lib/tasks/pgmodelgen.rake
CHANGED
@@ -728,7 +728,7 @@ class PGGen
|
|
728
728
|
end
|
729
729
|
|
730
730
|
#
|
731
|
-
# Add
|
731
|
+
# Add number constraints
|
732
732
|
#
|
733
733
|
models[table_name][:constraint] += "\n"
|
734
734
|
result.each do |row|
|
@@ -736,14 +736,8 @@ class PGGen
|
|
736
736
|
allow_nil = ((row['not_null_constraint'] != 't' or row['has_default_value'] == 't') ? ",:allow_nil => true" : "")
|
737
737
|
models[table_name][:constraint] += "\tvalidates_numericality_of :#{row['attribute_name']}, :only_integer => true #{allow_nil} \n"
|
738
738
|
end
|
739
|
-
|
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"
|
739
|
+
|
740
|
+
if row['type_name'].include? "float"
|
747
741
|
allow_nil = ((row['not_null_constraint'] != 't' or row['has_default_value'] == 't') ? ",:allow_nil => true" : "")
|
748
742
|
models[table_name][:constraint] += "\tvalidates_numericality_of :#{row['attribute_name']} #{allow_nil} \n"
|
749
743
|
end
|
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.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -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: -1192699231801375479
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|