Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:50:49+00:00 2026-05-26T22:50:49+00:00

I have a model List with an attribute called description of type string. Not

  • 0

I have a model “List” with an attribute called “description” of type string. Not a good idea so I want to change it to type text. However, I can’t change it.

I’ve done:

rails destroy model List

rake db:rollback

rake db:migrate

I then re-declare the model with description of type text and do a rake db:migrate.

Then I do:

rails c
ruby-1.9.2-p290 :002 > List
 => List(id: integer, name: string, popularity: string, vote_counter: integer, description: string, created_at: datetime, updated_at: datetime)

As you can see, description is still of type string.

I look in the migration and it’s of type text.

  def change
    create_table :lists do |t|
      t.string :name
      t.string :popularity
      t.integer :vote_counter
      t.text :description

      t.timestamps
    end
  end

How do I actually change it to text?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:50:50+00:00Added an answer on May 26, 2026 at 10:50 pm

    The problem is that “destroy model” removed your migration script. So rollback is not going to rollback your original model because there is no migration script for it to rollback. When you ran rake db:rollback, you didn’t really see the drop_table(:lists), did you? You should have not called destroy model just because you want to change the model.

    What you should have done is:
    1. rake db:rollback
    2. Change your migration script
    3. rake db:migrate

    The problem is that now your database still has the old table. So you need to manually remove your table from the database and run rake db:migrate again. That should solve your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of type IList<Effort> . The model Effort contains a float
I want to generate a list using my django model say I have these
In my spring web application I have arraylist in model attribute which I want
In a view model, I have a collection of items of type ClassA called
In my view model if have a: List<Car> where car has an Id and
In my Core Data model I have two entities: List and Patient. List has
I have a list of objects in a model. I wish to show elements
If I have a drop down list as follows <div class=editor-label> <%= Html.DropDownListFor(model =>
User is a model. I have 100 users. I need to present the list
I have a list of input type radio buttons in formview (edit mode) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.