Rails 3.1 引擎迁移不起作用 [英] Rails 3.1 engines migrations are not working

查看:46
本文介绍了Rails 3.1 引擎迁移不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个带有迁移功能的 rails 3.1 引擎.rake db:migration 在该引擎和主机应用程序内工作正常.但是我需要将这个引擎包含到另一个 rails 引擎中.第二个引擎包含用于测试的虚拟应用程序,我在该虚拟应用程序的 application.rb 中添加了这一行:

I'm creating a rails 3.1 engine with migrations. rake db:migration works fine inside that engine, and inside host app. But I need to include this engine into another rails engine. The second engine contains dummy app for testing, I added to application.rb of that dummy app this line:

require 'my_engine'

在控制台中,我可以看到来自第一个引擎的类.

In the console, I can see classes from the first engine.

rake -T

给我 app:my_engine_engine:install:migrations 任务,但是当我运行这个任务时

give me app:my_engine_engine:install:migrations task, but when I'm run this task

rake app:my_engine_engine:install:migrations

我收到此错误:

rake aborted!
Don't know how to build task 'railties:install:migrations'

Tasks: TOP => app:my_engine_engine:install:migrations
(See full trace by running task with --trace)

谁能帮我解决这个问题?

Can anyone help me with this trouble?

推荐答案

好吧,我找到了解决我的问题的方法.我只需要切换到我的测试应用程序目录并在那里运行:

Well, I'm find solution to my problem. I just needed to switch to my test app directory and to run there:

rake my_engine_engine:install:migrations

它可以正常工作.

这篇关于Rails 3.1 引擎迁移不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆