Sha256: 3cbd4e429f19178e1e53ecc4320ef58ba7cb15e37e9f49613e859d1839a3d726

Contents?: true

Size: 504 Bytes

Versions: 4

Compression:

Stored size: 504 Bytes

Contents

class PhoneNumberMigrationGenerator < Rails::Generator::NamedBase
  def initialize( runtime_args, runtime_options={} )
    super
    @stamp = DateTime.now.utc.strftime( "%Y%m%d%H%M%S" )
    parse_args( args )
  end
  
  def manifest
    record do |m|
      m.directory "db/migrate"
      m.template  "migration.rb", "db/migrate/#{@stamp}_#{name}.rb", :assigns => { :table => @table, :field => @field }
    end
  end

  private

  def parse_args( args )
    @table = args[0]
    @field = args[1]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phone_number-1.3.0 rails_generators/phone_number_migration/phone_number_migration_generator.rb
phone_number-1.2.0 rails_generators/phone_number_migration/phone_number_migration_generator.rb
phone_number-1.1.0 rails_generators/phone_number_migration/phone_number_migration_generator.rb
phone_number-1.0.0 rails_generators/phone_number_migration/phone_number_migration_generator.rb