Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 04ee14a450
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (20 sloc) 0.694 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
require 'rails/generators/active_record'
require 'rails/generators/active_record/migration/migration_generator'
require 'generators/roo'
#require 'genrators/active_record/validations_file'

module Roo
  module Generators
    class AddFieldGenerator < Roo::Generators::Base
      
      argument :field, :type => :string, :required => true, :banner => "field:type"

      parameters_argument

      def create_migration_file
        add_source_root
        init_new_column_options(@field)
        verify_field_missing(@new_field.name)
        init_new_index_options
        create_roo_migration_file("add", @new_field.name, "remove")
        rewrite_validations_file
      end
    end
  end
end
Something went wrong with that request. Please try again.