Rails 3.1 引擎 rake db:test:prepare 任务丢失
我正在开发 Rails 3.1 引擎,因为它是一个全新的版本,而且我正在边缘工作,所以我没想到事情会完美地进行。当我运行bundle exec rake -T时,我似乎无法让我的引擎看到db:test:prepare任务,
我正在使用rake 0.8.7和边缘导轨。如果我尝试要求虚拟应用程序的 Rakefile,我会得到
nil:NilClass 的未定义方法“先决条件” 在spec/dummy/Rakefile的第7行
我的Rakefile在spec/dummy/中的第7行是Dummy::Application.load_tasks
到目前为止我的研究已经把我带到了http://www.engineyard.com/blog/2010/rails-3 -beta-is-out-a-retrospective/ 对应于 databases.rake 。
如何将 db:test:prepare
任务放入我的引擎中?
I'm working on a rails 3.1 engine, and as it's a brand new release and I'm working off of edge, I didn't expect things to go perfectly. I can't seem to get my engine to see the db:test:prepare task when I run bundle exec rake -T
I'm using rake 0.8.7 and edge rails. If I try to require the dummy application's Rakefile, I get
undefined method 'prerequisites' for nil:NilClass
on line 7 of spec/dummy/Rakefile
Line 7 of my Rakefile in spec/dummy/ is Dummy::Application.load_tasks
My research so far has brought me to http://www.engineyard.com/blog/2010/rails-3-beta-is-out-a-retrospective/ which corresponds with databases.rake in Active Record.
How do I get the db:test:prepare
task into my engine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您必须以
app
为前缀,因此rake app:db:test:prepare
,或者只是rake app:test:prepare
。I think you have to prefix with
app
, sorake app:db:test:prepare
, or justrake app:test:prepare
.看起来像 http://blog.davidchelimsky.net/ 2011/05/22/rspec-rails-261beta1-is-released/ 就是答案。
原因是它可以防止在 nil 上调用先决条件,并且可以与 Rails 3.1 RC(或此时的边缘)一起使用。
Looks like http://blog.davidchelimsky.net/2011/05/22/rspec-rails-261beta1-is-released/ is the answer.
The reason being is that it guards against calling prerequisites on nil and will work with Rails 3.1 RC (or edge at this moment in time).
据我所知,它只是在rails 3.1中称为 rake test:prepare
As far as I know, then it's just called rake test:prepare in rails 3.1