Created
August 24, 2018 22:18
-
-
Save jilucev/a5e910d2285056ceace7f95c846d1c2b to your computer and use it in GitHub Desktop.
A rake task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :foo do | |
desc "Removes all bars for a given foo"\ | |
" Example: bundle exec rake foo:remove_bars[2]" | |
task :remove_bars, [:foo_id] => [:environment] do |t, args| | |
foo_id = args[:foo_id].to_i | |
Bar.where(foo_id: foo_id).delete_all | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment