Say I wanted to run 'User.all.each{|u| u.destroy}' from a shell script called killallusers.sh. How can I call Rails console commands from the shell or from an executable script?
Either write it as a Rake task , or use Rails "runner" .
Inside your shell script put the appropriate rake or runner command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.