0

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

来自 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
4

0 回答 0