摘要:最近在参照 Agile Web Development with Rails 4th edition 来学习 Ruby on rails,书中的开发环境是Ruby 1.8.6 or Ruby 1.9.1,Gem 1.3.6Rails 3.0.0 而我在ubuntu 12.04 上安装的开发环境是Ruby 1.9.3p19Gem 1.8.24rails 3.2.8. 主要由于用的是rails 3.2.8而非第4版书上使用的3.0 所以导致书中的有些例子不能正常运行,本系列就是一个学习笔记,把碰到的问题和解决办法记录下来。目前没有想到如何索引能够方便大家查看,先按 遇到的问题在书中Iter...
阅读全文
摘要:Q1. teration E1中,p142页 执行rake test:units 后出错:1) Failure:test_product_price_must_be_positive(ProductTest) [/home/csd/railsProjects/depot/test/unit/product_test.rb:36]:Failed assertion, no message given.看代码好像没什么错误的地方,hailong提醒我可以用 rails console --sandbox 命令, 使用 --sandbox 参数时, 对数据库的所有修改都会在退出console时回滚。
阅读全文
摘要:Q1. 创建工程后,使用rails server启动web server出错: root@ubuntu:/home/csd/railsProjects/demo# rails server/usr/local/rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available ru
阅读全文