How to run rake tasks from console?

后端 未结 5 460
南旧
南旧 2021-01-30 00:37

I want to invoke my rake task from console. Is it doable? if yes, how to do so?

I tried this on console:

require \         


        
5条回答
  •  萌比男神i
    2021-01-30 01:05

    The easiest way to do it is to run %x[command] from the irb. I'm not sure if what you want to achieve though.

    %x[rake db:migrate]
    

    EDIT: I highly recommend to use .invoke as Daniel says in the accepted answer.

提交回复
热议问题