6

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?

scieslak
  • 584
  • 6
  • 8

2 Answers2

8

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.

  • 5
    It is not clear from your answer what "test" directory you are talking about. Is it `/test/dummy` directory or is it some other test directory or is it from your main app's directory into which you want to mount your engine. What "test" directory did you mean? – Green Jun 13 '13 at 17:38
  • I'd monkey patch your app to do this automatically (see step #3): http://pivotallabs.com/leave-your-migrations-in-your-rails-engines/ – courtsimas Feb 18 '14 at 23:11
  • But I am getting this error `Don't know how to build task 'railties:install:migrations'` – Sourabh Upadhyay Mar 17 '15 at 10:55
1

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

And that works!

Outside_Box
  • 447
  • 1
  • 4
  • 16