开发者

How to perform rake after a create action?

开发者 https://www.devze.com 2023-03-06 21:20 出处:网络
I need to perform a rake after a create action开发者_JAVA技巧. I have a .rake in my lib/tasks dir. How do I tell rails to run the rake after a create action?You can call from your controller

I need to perform a rake after a create action开发者_JAVA技巧.

I have a .rake in my lib/tasks dir. How do I tell rails to run the rake after a create action?


You can call from your controller

system("rake_path your_command_here")

after create action. The system call returns true if successful.


You can call from your controller using two ways

 1. system("rake_path your_command_here")
 2. `rake_path your_command_here`


You can use

def create
  system "rake apn:notifications:deliver"
end
0

精彩评论

暂无评论...
验证码 换一张
取 消