Forum: Ruby on Rails Include rake migration in a plugin

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Alain m. L. (Guest)
on 2008-10-21 16:57
Hi there,

as sad as it seems, I can't find a hint on how to include a simple
statement like
  rake db:sessions:create
  rake db:migrate
in the rakefile of a plugin that I want to write myself.

Any help of of course appreciated - thanks in advance.

Best,
Alain M. Lafon
August L. (Guest)
on 2008-10-21 16:59
Alain m. Lafon wrote:
> as sad as it seems, I can't find a hint on how to include a simple
> statement like
>   rake db:sessions:create
>   rake db:migrate
> in the rakefile of a plugin that I want to write myself.

You can invoke rake tasks with Rake::Task['task:name'].invoke.
Alain m. L. (Guest)
on 2008-10-21 18:27
August L. wrote:
> Alain m. Lafon wrote:
>> as sad as it seems, I can't find a hint on how to include a simple
>> statement like
>>   rake db:sessions:create
>>   rake db:migrate
>> in the rakefile of a plugin that I want to write myself.
>
> You can invoke rake tasks with Rake::Task['task:name'].invoke.

Thank you very much, this works nicely - now I have the option to call
my own rake task.
But is it possible to include this task in say the generator of the
plugin so that it may be called on installation of the plugin?
This topic is locked and can not be replied to.