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.12 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.11 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.20 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.10 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.19 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.9 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.18 lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.8 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.17 lib/rails/generators/active_record/migration/migration_generator.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/activerecord-3.1.1/lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.1.7 lib/rails/generators/active_record/migration/migration_generator.rb
activerecord-3.0.16 lib/rails/generators/active_record/migration/migration_generator.rb