Class: ActsAsMultipartForm::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActsAsMultipartForm::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/acts_as_multipart_form/install_generator.rb
Overview
Generator for copying the InProgressForm model migration and an initializer 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_config_file ⇒ Object
Creates the config file Commented out until the config actually has information.
-
#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
23 24 25 26 27 28 29 30 |
# File 'lib/generators/acts_as_multipart_form/install_generator.rb', line 23 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_config_file ⇒ Object
Creates the config file Commented out until the config actually has information
34 35 36 |
# File 'lib/generators/acts_as_multipart_form/install_generator.rb', line 34 def copy_config_file copy_file "config.rb", "config/initializers/acts_as_multipart_form.rb" end |
#copy_migration ⇒ Object
Creates the migration
39 40 41 |
# File 'lib/generators/acts_as_multipart_form/install_generator.rb', line 39 def copy_migration migration_template "migrations/install_migration.rb.erb", "db/migrate/create_multipart_form_tables.rb" end |