Common Commands for Rails

Source: Internet
Author: User

Common Commands for Rails: (Rails version:4.2.0)
1. New Rails project, rails new project name –skip-bundle (this is to skip the bundle dependency check)
2. New controller and Model: Rails generate (g) model name (singular) field: Properties ...
Rails Generate (g) Controller controllers name (same as model name)
3. Data migration: Bin/rake db:migrate
4.rails Console (c) can enter Rails ' main console (similar to IRB) where database tables can be manipulated
5. You can add a field to a table in the database: Rails g (generate) Add_status_to_ model name (plural)
6. In the bin directory, there is bundle,rails,rake,setup. Generally used more is the rails command under the
7.bin/rails server (s) startup
8.bin/rake Db:create Building a database
9. Use of scaffolding bin/rails g (generate) Scaffold model name (singular) field: Properties ...
10.Rails provides bin/rake stats can know how many lines of code have been written

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.