Rails关注不加载

时间:2014-08-09 16:43:26

标签: ruby-on-rails ruby-on-rails-3.2 activesupport-concern

application.rb我有

config.autoload_paths += %W(
      #{config.root}/lib/middleware 
      #{config.root}/lib 
      #{config.root}/lib/quickbooks/* 
      #{config.root}/lib/**/ 
      #{config.root}/app/models/concerns 
      #{config.root}/app/models/account)

并且在app/models/account我有一个名为new_account_creation.rb的文件,其中包含以下内容:

module Account::NewAccountCreation
  extend ActiveSupport::Concern

  included do
  end
end

最后,在我的account.rb模型文件中,我有:

class Account < ActiveRecord::Base
  include Account::NewAccountCreation
end

每当我运行bundle exec rake routes时,我都会在下方收到此错误,就好像问题并未加载一样。我被困了,有什么不对?

rake aborted!
NameError: uninitialized constant Account::NewAccountCreation
/Users/Ackerman/src/Printavo/app/models/account.rb:57:in `<class:Account>'
/Users/Ackerman/src/Printavo/app/models/account.rb:56:in `<top (required)>'
/Users/Ackerman/src/Printavo/lib/tasks/populate.rake:3:in `<top (required)>'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.19/lib/rails/engine.rb:425:in `block in load_tasks'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.19/lib/rails/engine.rb:425:in `each'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.19/lib/rails/engine.rb:425:in `load_tasks'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.19/lib/rails/application.rb:145:in `load_tasks'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/Ackerman/src/Printavo/Rakefile:7:in `<top (required)>'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/Ackerman/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

0 个答案:

没有答案