How to perform rake after a create action?
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
精彩评论