0%

ruby 学习笔记二

>rails new depot

生成脚手架

> rails generate scaffold Product title:string description:text image_url:string price:decimal

生成数据:

rake db:migrate

rails server -p 9000

rake  db:seed # 生成数据example  vim app/db/seeds.rb

rake db:rollback 撤销数据库 。

git 版本控制:

depot> gitconfig --global --add user.name "Sam Ruby" depot> gitconfig --global --add user.email rubys@intertwingly.net You can verify the configuration with the following command: depot> gitconfig --file .gitconfig --list

git init

git add .

git commit -m "add now version v1"