Class: SettingsGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- SettingsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/settings/settings_generator.rb
Constant Summary collapse
- @@migrations =
false
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
:nodoc:
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/generators/settings/settings_generator.rb', line 13 def self.next_migration_number(dirname) #:nodoc: if ActiveRecord::Base. if @@migrations (current_migration_number(dirname) + 1) else @@migrations = true Time.now.utc.strftime('%Y%m%d%H%M%S') end else format '%.3d', current_migration_number(dirname) + 1 end end |
Instance Method Details
#settings ⇒ Object
26 27 28 29 30 |
# File 'lib/generators/settings/settings_generator.rb', line 26 def settings # generate(:model, name, "--skip-migration") template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb"), force: true migration_template 'migration.rb', 'db/migrate/create_settings.rb' end |