Class: ActiveMailer::MigrationGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ActiveMailer::MigrationGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/active_mailer/migration/migration_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/generators/active_mailer/migration/migration_generator.rb', line 14 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
10 11 12 |
# File 'lib/generators/active_mailer/migration/migration_generator.rb', line 10 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#attributes_with_index ⇒ Object
26 27 28 |
# File 'lib/generators/active_mailer/migration/migration_generator.rb', line 26 def attributes_with_index attributes.select { |a| a.has_index? || (a.reference? && [:indexes]) } end |
#create_migration_file ⇒ Object
22 23 24 |
# File 'lib/generators/active_mailer/migration/migration_generator.rb', line 22 def create_migration_file migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb" end |