Class: ArMailerAwsGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ArMailerAwsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/ar_mailer_aws/ar_mailer_aws_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner ⇒ Object
24 25 26 |
# File 'lib/generators/ar_mailer_aws/ar_mailer_aws_generator.rb', line 24 def self. 'Usage: rails ar_mailer_aws EmailModelName (default: BatchEmail)' end |
.next_migration_number(dirname) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/ar_mailer_aws/ar_mailer_aws_generator.rb', line 16 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.now.utc.strftime('%Y%m%d%H%M%S') else '%.3d' % (current_migration_number(dirname) + 1) end end |
Instance Method Details
#create_ar_mailer_files ⇒ Object
9 10 11 12 13 14 |
# File 'lib/generators/ar_mailer_aws/ar_mailer_aws_generator.rb', line 9 def create_ar_mailer_files self.class.check_class_collision class_name template('ar_mailer_aws.rb', 'config/initializers/ar_mailer_aws.rb') template('model.rb', File.join('app/models', class_path, "#{file_name}.rb")) migration_template 'migration.rb', "db/migrate/create_#{file_path.gsub(/\//, '_').pluralize}.rb" end |