Sha256: b152661cd165e588808fe0598c9ad38d52eed7c8c17aa3786ea164683d975cb0

Contents?: true

Size: 852 Bytes

Versions: 5

Compression:

Stored size: 852 Bytes

Contents

require 'rails/generators/named_base'
require 'rails/generators/migration'
require 'rails/generators/active_model'
require 'active_record'

module ActiveRecord
  module Generators
    class Base < Rails::Generators::NamedBase #:nodoc:
      include Rails::Generators::Migration

      # Set the current directory as base for the inherited generators.
      def self.base_root
        File.dirname(__FILE__)
      end

      # Implement the required interface for Rails::Generators::Migration.
      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-3.0.1 lib/rails/generators/active_record.rb
activerecord-3.0.0 lib/rails/generators/active_record.rb
activerecord-3.0.0.rc2 lib/rails/generators/active_record.rb
activerecord-3.0.0.rc lib/rails/generators/active_record.rb
activerecord-3.0.0.beta4 lib/rails/generators/active_record.rb