Rails 3.1 engines migrations are not working

牧云@^-^@ 提交于 2019-12-10 13:29:11

问题


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

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

rake app:my_engine_engine:install:migrations

I'm getting this error:

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?


回答1:


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

and it works as it should.




回答2:


For rails3 you need to cd /test/testapp, then rake community_engine:install:migrations

And that works!



来源:https://stackoverflow.com/questions/7064265/rails-3-1-engines-migrations-are-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!