Class: RunOnceGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- RunOnceGenerator
- Defined in:
- lib/generators/run_once/run_once_generator.rb
Overview
rails generate run_once NAME
Generates a timestamped run_once rake task, just like a db migration:
rails generate run_once upgrade_to_effective_cpd_seven
=> db/run_once/20260227230301_upgrade_to_effective_cpd_seven.rake
Instance Method Summary collapse
Instance Method Details
#create_run_once_task ⇒ Object
13 14 15 16 |
# File 'lib/generators/run_once/run_once_generator.rb', line 13 def create_run_once_task = Time.now.utc.strftime('%Y%m%d%H%M%S') template 'run_once_task.rake.tt', File.join('db', 'run_once', "#{}_#{file_name}.rake") end |