Class: Settings::InstallGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Settings::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/settings/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/settings/install/install_generator.rb', line 24 def self.next_migration_number(dirname) if ActiveRecord::Base. if Dir.glob(dirname + "/*.rb").any? current_migration_number(dirname) + 1 else Time.now.utc.strftime("%Y%m%d%H%M%S") end else format("%.3d", current_migration_number(dirname) + 1) end end |
Instance Method Details
#main ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/settings/install/install_generator.rb', line 13 def main @class_name = class_name @default_config_file = "default_" + table_name + ".yml" @migration_class_name = "Create" + table_name.camelize @table_name = table_name copy_migration copy_model copy_default_config end |