Created
September 23, 2020 06:57
-
-
Save krzykamil/3ef2fdfa77d2ef7811303052c8d75550 to your computer and use it in GitHub Desktop.
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
# frozen_string_literal: true | |
desc "example task" | |
task :example_task, [:for_real] => [:environment] do |task, args| | |
ActiveRecord::Base.transaction do | |
# This is the way, do your thing here | |
unless args[:for_real] == "for_real" | |
raise "Discarded all changes. To do a real run invoke this task as follows: | |
bundle exec rake \"#{task.name}[for_real]\"\n" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment