• #18 楼 @Rei 好的,谢谢你!

  • 有! #16 楼 @Rei

  • #14 楼 @Rei

    (rdb:1) p e.backtrace
    ["/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/attribute_methods/write.rb:28:in `write_attribute'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/attribute_methods/dirty.rb:67:in `write_attribute'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/attribute_methods/write.rb:14:in `name='", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/attribute_assigner.rb:14:in `block (2 levels) in object'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/attribute_assigner.rb:13:in `each'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/attribute_assigner.rb:13:in `block in object'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/attribute_assigner.rb:12:in `tap'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/attribute_assigner.rb:12:in `object'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/strategy/create.rb:9:in `result'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/factory.rb:48:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/factory_runner.rb:23:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/syntax/methods.rb:63:in `create'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/syntax/vintage.rb:50:in `default_strategy'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/factory_girl-2.6.1/lib/factory_girl/syntax/vintage.rb:143:in `Factory'", "/Users/kaka/Documents/soft/neza/spec/models/inventory_spec.rb:19:in `block (3 levels) in <top (required)>'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in `instance_eval'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in `block in run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:173:in `with_around_hooks'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:77:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:355:in `block in run_examples'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:351:in `map'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:351:in `run_examples'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:337:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `map'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `block in run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:34:in `report'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:25:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'", "/Users/kaka/Documents/soft/neza/vendor/gems/ruby/1.9.1/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'"]``` 
    
  • 晕倒,发错了!

  •         begin
        it "should factory" do
            @iphone = Factory :iPhone4
            debugger
            iphone.should_not be_nil, @iphone.errors.inspect
        end
    rescue Exception => e
        debugger
        puts e.backtrace
    end
    
    

    #12 楼 @Rei

  • #10 楼 @Rei 你试了,放 begin 代码块不会执行

  • #7 楼 @Rei 我 checkout 之前的分支,测试可能通过,没有出错误

  • @Rei6 行的代码 let(:iPhone4) { Factory :iPhone4 } 我在 it 里面 debugger 用 Factory(:iPhone4) 也是出现这种错误!

  • #4 楼 @Rei 我刚才把 Product 模型与控制器内容全注释,还是一样! 这个问题 git 分支合并的时候出现,之前没有合并分支的时候还没有问题!

  • Failure/Error: let(:iPhone4) { Factory :iPhone4 }
     NoMethodError:
          undefined method `delete' for nil:NilClass
        # ./spec/controllers/inventory_controller_spec.rb:6:in `block (2 levels) in <top (required)>'
        # ./spec/controllers/inventory_controller_spec.rb:20:in `block (3 levels) in <top (required)>'
    
    

    是不是这样的错误信息啊! #3 楼 @Rei

  • #1 楼 @Rei 在 Product 模型与控制器我都查过,没有看到那里调用 delete

  • 诚聘!

  • 可以啊!扩展

  • rake environment RAILS_ENV=test db:migrate

  • 我也认为 #16 楼 @Rei 看法!

  • 今天一看,头像终于显示了...

  • 报名

  • 310 飘过

  • feipinghuang 现在在那里混啊!

  • ubuntu 吧!mac 支持!

  • Mongoid 怎样做关联查询? at 2012年02月09日

    学习!

  • Node.js 中文社区 at 2012年02月08日

    在那提一个 nodejs 问题一两天没有人回

  • 分享 mac 上的好东西 powder at 2012年02月08日

    嗯 .... 很方面吧!

  • 广州 Ruby-China.org hackathon at 2012年02月07日

    呵...我想参与!j

  • 呵...黑 mac 贡献 1

  • 谢谢

    #19 楼 @metal

  • config.assets.compile = true 把这个预编译开启就可以了 #19 楼 @metal

  • #17 楼 @metal 不行 不知道是我项目那些东西没有编译到... 应该是项目的问题

  • 我 rails s -e production 运行项目 也是 500 错误 但是 rails s 就正常 #15 楼 @metal touch 不管用