Sha256: df9226d255af2cfd515122ca81cf3efd4e00037aad5d6a8c916452eda44ad795

Contents?: true

Size: 630 Bytes

Versions: 99

Compression:

Stored size: 630 Bytes

Contents

require 'rails/generators/active_record'

module ActiveRecord
  module Generators
    class MigrationGenerator < Base
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

      def create_migration_file
        set_local_assigns!
        migration_template "migration.rb", "db/migrate/#{file_name}.rb"
      end

      protected
        attr_reader :migration_action

        def set_local_assigns!
          if file_name =~ /^(add|remove)_.*_(?:to|from)_(.*)/
            @migration_action = $1
            @table_name       = $2.pluralize
          end
        end

    end
  end
end

Version data entries

99 entries across 99 versions & 3 rubygems

Version Path
activerecord-3.1.0.rc8 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.rc6 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.10 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.10.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.rc5 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.9 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.9.rc5 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.9.rc4 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.rc4 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.9.rc3 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.rc3 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.9.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.rc2 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.8 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.8.rc4 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.8.rc2 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.8.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
square-activerecord-3.0.7 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0.beta1 lib/rails/generators/active_record/migration/migration_generator.rb