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?
Say I wanted to run ‘User.all.each{|u| u.destroy}’ from a shell script called killallusers.sh. How
Share
Either write it as a Rake task, or use Rails “runner”.
Inside your shell script put the appropriate rake or runner command.