lib/ar2gostruct/builder/orm/gorm.rb in ar2gostruct-0.2.0 vs lib/ar2gostruct/builder/orm/gorm.rb in ar2gostruct-0.2.1
- old
+ new
@@ -14,13 +14,13 @@
orm_option << "not null"
end
# set size
if col.type == :string
# SQL type
- if col.sql_type
+ if col.sql_type && /\A\w+\(\d+\)/.match(col.sql_type)
orm_option << "type:#{col.sql_type}"
end
- orm_option << "size:#{col.limit}"
+ orm_option << "size:#{col.limit}" if col.limit
end
if orm_option.present?
return "sql:\"#{orm_option.join(TAG_SEPARATOR)}\""
else
\ No newline at end of file