After finding 2 SO questions related to string vs. text fields, I discovered that the link field is already text:
create_table "answers", :force => true do |t|
t.string "text"
t.text "link"
Why is Postgres throwing the following error:
ActiveRecord::StatementInvalid: PG::Error: ERROR: value too long for type character varying(255)
I tried a migration change_column :answers, :link, :text, :limit => nil but I don’t think that does anything.
Edit: So, the problem is that the schema says the field is text, but actually it is string:
Answer.new.column_for_attribute('link').type
=> :string
What is the best way to fix it? By rebuilding the database from the schema? By changing it to string and then back to text?
Rails 3.2.2, Postgres 9, Heroku.
Not quite sure how it happened, but one of the following: