开发者

discrepancy between requiring a path in rails console vs. rails s (WeBRICK)

I'm using Machinist blueprints in development.

from development.rb:

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

it works fine in the console.

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, ....

When I run the server, my controllers know that my models respond to #make, but they don't know that the blueprints are defined.

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

This is odd because the statement

require 'machinist/active_record'

is in the blueprints.rb file. Also, the "loaded!" statement gets printed out in my server log.

=> Ctrl-C to shutdown server
********* blueprints l开发者_开发技巧oaded! *********
=> Debugger enabled
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜