点击 【Destroy】 后会根据我们的定义弹出提示
连续删除几次后所剩无几
目前已经通过 Rails 实现了文章的 新建、显示、列出、更新、删除 操作
命令汇总
rails server -b 0.0.0.0
rails generate controller welcome index
cat app/views/welcome/index.html.erb
vim config/routes.rb
grep -v " #" config/routes.rb | grep -v "^$"
rake routes
bin/rails g controller articles
cat app/controllers/articles_controller.rb
cat app/views/articles/new.html.erb
bin/rake routes
cat app/controllers/articles_controller.rb
bin/rails generate model Article title:string text:text
cat db/migrate/20160422140912_create_articles.rb
cat app/models/article.rb
bin/rake db:migrate
cat config/database.yml
grep -v "^#" config/database.yml
ll db/development.sqlite3
cat app/controllers/articles_controller.rb
cat app/views/articles/index.html.erb
cat app/views/articles/show.html.erb
cat app/views/articles/new.html.erb
cat app/models/article.rb
cat app/controllers/articles_controller.rb
cat app/views/articles/new.html.erb
cat app/views/articles/edit.html.erb
cat app/views/articles/index.html.erb
原文地址