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
dirty_history-0.4.9 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.2.0.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.8 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.7 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.6 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.5 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.4 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.3 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.4.2 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.3 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.2 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.11 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.2.rc2 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.2.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.3.0 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.1 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.1.rc3 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.1.rc2 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.1.rc1 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.0 lib/rails/generators/active_record/migration/migration_generator.rb