Class: PostmanPatGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/postman_pat/postman_pat_generator.rb,
lib/generators/postman_pat_generator.rb

Overview

class PostmanPatGenerator < Rails::Generators::NamedBase

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

Implement the required interface for Rails::Generators::Migration.



9
10
11
12
13
14
15
16
# File 'lib/generators/postman_pat/postman_pat_generator.rb', line 9

def self.next_migration_number(dirname) #:nodoc:
  next_migration_number = current_migration_number(dirname) + 1
  if ActiveRecord::Base.timestamped_migrations
    [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

#create_migrationObject



18
19
20
21
# File 'lib/generators/postman_pat/postman_pat_generator.rb', line 18

def create_migration
  migration_template 'create_pm_mails_migration.rb', File.join('db', 'migrate', 'create_pm_mails.rb')
  migration_template 'create_pm_messages_migration.rb', File.join('db', 'migrate', 'create_pm_messages.rb')
end