Ben
Ben

Reputation: 563

datatype text in mysql (Ruby on Rails)

In development I used sqlite3 and I was writing a blog application. So for the blog articles, I had datatype text which worked fine. I was able to write really long articles, never had a problem. Switch over to production using MySQL and now my articles are getting truncated after around 250 characters.

Does anyone know what I need to do and/or change to get MySQL to behave like sqlite3 was, allowing really large bodies of text?

Thank you.

db/schema.rb:

ActiveRecord::Schema.define(:version => 20110307222323) do

  create_table "articles", :force => true do |t|
    t.integer  "user_id"
    t.string   "title"
    t.string   "body"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "category_id"
    t.string   "url"
  end
end

Upvotes: 4

Views: 2040

Answers (2)

You must to change:

 t.text :body #change here

You can find more information about data type comparisons here

Upvotes: 0

thekindofme
thekindofme

Reputation: 3866

May be you should replace

t.string   :body

with

t.text   :body

Upvotes: 7

Related Questions