rails new blog

cd blog
bundle install
rake ddb:create
rails s
==========
rails g controller home index
rm public/index.html
 
config/routes.rb: 设置路由  利用DSL保存木条
 
root  :to => 'Home#index'
 
采用脚手架:
rails g scaffold post name:string title:string content:text
=====>生成了迁移文件 : 
rake db:migrate
'=============
超链接:
<%= link_to 'My Blog', posts_path%>
 
模型研究:
验证:validates :name,  :presence=>true
           validates :title,      :presence =>true,  :length=>{mininujm=>5}
 
rails c