在rails控制台与rails s之间需要路径之间的差异(WeBRICK)

时间:2011-04-23 20:40:58

标签: ruby-on-rails machinist

我正在开发中使用机械师蓝图。

来自development.rb的

config.after_initialize do
  require 'spec/support/blueprints'
  puts "********* blueprints loaded! *********"
end

它在控制台中运行良好。

michael-schwabs-macbook-pro:medtext mschwab$ rails c
********* blueprints loaded! *********
Loading development environment (Rails 3.0.7)
irb(main):001:0> d = Doctor.make
=> #<Doctor id: 101, first_name: nil, ....

当我运行服务器时,我的控制器知道我的模型响应#make,但他们不知道蓝图已定义。

(rdb:70) Doctor.respond_to?(:make)
true
(rdb:70) Doctor.make
RuntimeError Exception: No blueprint for class Doctor

这很奇怪,因为声明

require 'machinist/active_record'

位于blueprints.rb文件中。还有,“装!”语句在我的服务器日志中打印出来。

=> Ctrl-C to shutdown server
********* blueprints loaded! *********
=> Debugger enabled

0 个答案:

没有答案