mardi 8 décembre 2015

Ruby on Rails - Postgres: Array value must start with "{" or dimension information

For my Rails app im switching from sqlite3 to Postgres for the production environment. I want to take the data from the sqlite db to the postgres db.

I set up postgres and the superuser.

When I user rake db:setup all goes well up to the part where it is supposed to seed the db.

This error appears:

rake aborted!
ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR:  malformed array literal: "---
- ''
"
DETAIL:  Array value must start with "{" or dimension information.

My database contains arrays and this worked fine on sqlite, even when migrating and seeding to a new setup.

I guess the error is caused by the syntax not being compatible with a postgres db. Can i create a seeds.rb file that contains the right syntax if that is the case?

Any help is appreciated.

Versions:

Rails 4.1.8
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

Aucun commentaire:

Enregistrer un commentaire