I''ve been trying to get rails to work successfully with the native geometric 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 converts geometric typed columns to string types, meaning tests which utilise geometric functions blow up as they are now dealing with strings in the underlying database. 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Placing this: config.active_record.schema_format = :sql in your environment would solve your test database problems. Tiago Macedo Jon Smillie wrote:> I''ve been trying to get rails to work successfully with the native geometric > 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 converts > geometric typed columns to string types, meaning tests which utilise geometric > functions blow up as they are now dealing with strings in the underlying database. > > 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 ..... > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---