Forum: Ruby on Rails postgres geometric types support

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
28532bafdc9a875478add2363ff84ac5?d=identicon&s=25 Jon Smillie (Guest)
on 2007-05-17 04:30
(Received via mailing list)
I've been trying to get rails to work successfully with the native
types in postgres (point, box, etc), but out of the box rails dumbs
these down
to string types. This means that when rake creates my test database, it
geometric typed columns to string types, meaning tests which utilise
functions blow up as they are now dealing with strings in the underlying

I managed to get around this with two changes in the ruby postgres
adapter, and
one in the active record schema_definitions file:

In postgresql_adapter.rb I added definitions for the geometric types to
"native_database_types", and I uncommented the line which handles these
types (interesting
that it was there) in "translate_field_type".

In the active record file schema_definitions.rb I added clauses to
handle these
types to "simplified_type".

I don;t know if these was a better or nicer way I should have done this

Jon Smillie
ANU Supercomputer Facility
17fd339dc782f5adc7f57437e653d2cd?d=identicon&s=25 Tiago Macedo (Guest)
on 2007-05-17 15:45
(Received via mailing list)
Placing this:

config.active_record.schema_format = :sql

in your environment would solve your test database problems.

Tiago Macedo
This topic is locked and can not be replied to.