Class: GuineaPig::MigrationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/guinea_pig/migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

:nodoc:



12
13
14
15
16
17
18
19
20
# File 'lib/generators/guinea_pig/migration_generator.rb', line 12

def self.next_migration_number(dirname) #:nodoc:
  migration_number_attempt = Time.now.utc.strftime("%Y%m%d%H%M%S")

  if ActiveRecord::Base.timestamped_migrations && migration_number_attempt > current_migration_number(dirname).to_s
    migration_number_attempt
  else
    serial_migration_number(dirname)
  end
end

.source_rootObject



8
9
10
# File 'lib/generators/guinea_pig/migration_generator.rb', line 8

def self.source_root
  File.join(File.dirname(__FILE__), "templates")
end

Instance Method Details

#copy_migrationObject



22
23
24
# File 'lib/generators/guinea_pig/migration_generator.rb', line 22

def copy_migration
  migration_template "create_ab_tests.rb", "db/migrate/create_ab_tests.rb"
end