美文网首页
常见命令

常见命令

作者: Shorebloom_59f6 | 来源:发表于2019-12-19 12:07 被阅读0次
    1. 测试代码是否正确
    bundle exec rake test
    
    1. 设置根路由

    修改config 文件夹下的routes.rb文件

    root  'static_pages#home'
    

    注: static_pages#home为页面路径, 修改路由之后,/static_pages/home 就无法访问了

    1. 生成新的控制器
    rails generate controller StaticPages home help
    

    生成新的控制器StaticPages, 文件名为static_pages.rb 包含两个页面home页面和help页面。

    1. 撤销操作
    rails destroy  controller StaticPages home help
    
    1. 生成一个集成测试文件
    rails generate integration_test users_login
    
    1. 执行单个测试文件
    bundle exec rake test TEST=test/integration/users_login_test.rb
    

    相关文章

      网友评论

          本文标题:常见命令

          本文链接:https://www.haomeiwen.com/subject/szedoftx.html