New Class
Copy codeThe Code is as follows: ruby script/generate Model <Class Name> <Field 1 >:< type>...
Ruby script/generate Model Item name: string age: integer
Remove Class
Copy codeThe Code is as follows: ruby script/destroy Model
New Controller
Copy codeThe Code is as follows: ruby script/generate Controller <Controller Name> <Action 1> <Action 2>...
Ruby script/generate Controller Web index remove news ....
Add Field
Copy codeThe Code is as follows: ruby script/generate Migration Add <Migration File ID> To <Class Name> <Field 1 >:< type>...
Ruby script/generate Migration AddLanguagesToLive english_name: string japanese_name: string
Remove Field
Copy codeThe Code is as follows: ruby script/generate Migration Remove <Migration File ID> From <Class Name> <Field 1 >:< type>...
Ruby script/generate Migration RemoveLanguagesFromLive english_name: string japanese_name: string
Application database migration File(Make the database structure modification take effect)
Copy codeThe Code is as follows: rake db: migrate
Rake db: migrate RAILS_ENV = production
Roll back the last modification
Copy codeThe Code is as follows: rake db: rollback
Clear logs
Copy codeThe Code is as follows: rake log: clear
View logs
Copy codeThe Code is as follows: type log \ production. log
Create a project
Copy codeThe Code is as follows: Rails project name
Rails demo
Start ruby Service
Copy codeThe Code is as follows: ruby script/server
Database Operations
Copy codeThe Code is as follows: ruby script/console