0
votes

Gem file:

gem "oauth2"
gem "omniauth-gmail"
gem 'omniauth-facebook'
gem "omniauth-google-oauth2"

I am new in ruby on rails . I am succeffuly sign up with facebook but when I will try to sign up with gmail then I got the following PG error.

pls give me any suggestion , I also change the data type of address from string to text but did not get result.


ActiveRecord::StatementInvalid at /users PG::StringDataRightTruncation: ERROR: value too long for type character varying(255) : INSERT INTO "users" ("address", "city", "confirmation_sent_at", "confirmation_token", "confirmed_at", "country", "created_at", "current_sign_in_at", "current_sign_in_ip", "email", "encrypted_password", "facebookimage", "image", "last_sign_in_at", "last_sign_in_ip", "latitude", "longitude", "membership", "provider", "remember_created_at", "reset_password_sent_at", "reset_password_token", "sign_in_count", "state", "uid", "unconfirmed_email", "updated_at", "username", "zip") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29) RETURNING "id" Application Frames All Frames rescue in log activerecord (3.2.12) lib/active_record/connection_adapters/abstract_adapter.rb, line 285


3

3 Answers

3
votes

The field should be of type :text, not of :string in your migration file.

0
votes

Or, here is direct method using the pg:psql from the heroku command line. You should definitely add a migration file that addresses this as well to not create any discrepancies.

http://www.dchapman.io/posts/changing-column-type-in-postgresql-rails

0
votes

This can be caused by a outdated migration test db in remote servers.

Try:

rake db:migrate db:test:prepare

and run your migration again.