Reputation: 135
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?
Upvotes: 4
Views: 4408
Reputation: 160631
Either write it as a Rake task, or use Rails "runner".
Inside your shell script put the appropriate rake or runner command.
Upvotes: 11