Class: Schedulable::Generators::OccurrenceGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Schedulable::Generators::OccurrenceGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/schedulable/occurrence_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
14 15 16 |
# File 'lib/generators/schedulable/occurrence_generator.rb', line 14 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#create_migrations ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/schedulable/occurrence_generator.rb', line 18 def create_migrations puts 'create schedulable occurrence model' migration_template 'migrations/create_occurrences.erb', "db/migrate/create_#{name.tableize}.rb", {name: self.name, attributes: self.attributes} template 'models/occurrence.erb', "app/models/#{name.tableize.singularize}.rb", {name: self.name, attributes: self.attributes} end |