Rails field addition, deletion, and modification commands

Source: Internet
Author: User

1. In fact, every time the rails C Console reads files in the model, they will not be updated automatically. Therefore, when adding fields, you must first write the fields in the model file, then restart rails C to find this field.

2. Add a field: rails g migration add_column_to_model field name: Type

Then, the Migration task will not succeed if you want to add fields to the model. The migration file already exists, so you can only delete fields.

The rails g migrationk remove_column_from_model field name is to delete the previous migration file.

Add two fields again to execute the migration task.

Rails field addition, deletion, and modification commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.