Class: TrackableTasks::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- TrackableTasks::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/trackable_tasks/install_generator.rb
Overview
Generator for copying the base migration and the rakefile to the including project
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
Instance Method Summary collapse
-
#copy_migration ⇒ Object
Creates the migration.
Class Method Details
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration. thanks Kaminari gem for this bit of code
22 23 24 25 26 27 28 29 |
# File 'lib/generators/trackable_tasks/install_generator.rb', line 22 def self.next_migration_number(dirname) #:nodoc: next_migration_number = current_migration_number(dirname) + 1 if ActiveRecord::Base. [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max else "%.3d" % next_migration_number end end |
Instance Method Details
#copy_migration ⇒ Object
Creates the migration
32 33 34 |
# File 'lib/generators/trackable_tasks/install_generator.rb', line 32 def copy_migration migration_template "migrations/install_migration.rb.erb", "db/migrate/create_trackable_task_tables.rb" end |