module Rockstart::Generators::MigrationHelpers

Adds helpers for generating migrations provided by rockstart

Public Class Methods

next_migration_number(dirname) click to toggle source

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

# File lib/rockstart/generators/migration_helpers.rb, line 13
def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Protected Instance Methods

migration_version() click to toggle source
# File lib/rockstart/generators/migration_helpers.rb, line 25
def migration_version
  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if rails5_and_up?
end
rails5_and_up?() click to toggle source
# File lib/rockstart/generators/migration_helpers.rb, line 21
def rails5_and_up?
  Rails::VERSION::MAJOR >= 5
end