lib/pg_graph/inflector.rb in pg_graph-0.1.0 vs lib/pg_graph/inflector.rb in pg_graph-0.1.1
- old
+ new
@@ -84,21 +84,22 @@
# Types are both native postgres type and types from the information_schema
def postgres_type2ruby_class(name)
case name
when "character varying", "varchar", "text", "uuid"; String
when "smallint", "integer", "int4", "int2"; Integer
- when "double precision", "float8", "numeric"; Float
+ when "double precision", "real"; Float
+ when "numeric", "decimal"; BigDecimal
when "bool", "boolean"; Boolean
when "json"; Hash
when "bytea"; String
when "timestamp", "timestamp without time zone"; Time
when /^_/; Array
else
raise "Unsupported postgres type: #{name.inspect} (FIXIT!)"
end
end
- SUPPORTED_RUBY_CLASSES = [String, Integer, Float, Boolean, Hash, Time, NilClass, Array]
+ SUPPORTED_RUBY_CLASSES = [String, Integer, Float, BigDecimal, Boolean, Hash, Time, NilClass, Array]
end
def self.inflector() @inflector ||= Inflector.new end
end