Common rails commands

Source: Internet
Author: User

Rails new demo-D MySQL creates a project using MySQL

Rails g controller welcome creates a new welcome Controller

Rake DB: create creates an empty database based on the configuration

Rails g scaffold person name: String Bio: Text birthday: Date

Rake DB: migrate executes all files under DB/migration (used for database operations)

Rails G model event name: String Description: Text is_public: Boolean capacity: integer creates a event ing of the event object (compared with scaffold, no page for adding, deleting, modifying, and querying is generated)

Rails g migration add_status_to_events creates a migration


# Typical route: it automatically maps the network address/Foo/bar to the Controller.
Bar action of foo
Match ': controller (/: Action (/: ID) (.: Format )'

Rake stats list code count, etc.

Open a rails Console

Rails Console

Rails C

Rails c -- sandbox (open in sandbox)

Start the service

Rails s-p 4000-e Production

All gems used are packaged into the vendor/Cache

Bundle package

List all URLs
Helper, URL, and corresponding Controller
Action

Rake routes









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.