Sha256: ab8a79354eb8e4dff456c4c433930acb156554ab2f141e5a1c8404e2d916dd83

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

class GeographyGenerator < Rails::Generator::NamedBase
  def manifest
    record do |m|
      
      # Models
      m.template 'models/continent.rb', 'app/models/continent.rb'
      m.template 'models/country.rb', 'app/models/country.rb'
      m.template 'models/state.rb', 'app/models/state.rb'
      m.template 'models/region.rb', 'app/models/region.rb'
      m.template 'models/county.rb', 'app/models/county.rb'

      # Migrations
      # Individual migrations are temporarily unavailable due to Rails bug #487
      # (http://www.google.com/url?sa=t&source=web&ct=res&cd=36&url=https%3A%2F%2Frails.lighthouseapp.com%2Fprojects%2F8994%2Ftickets%2F487-migration-timestamp-clash-problems-with-generators&ei=ZievSunQBYzQtgOkj6TLCw&usg=AFQjCNGz1QBjpeupLXjphKCsB0uPYwD18w)
      # Using a combined migration file instead.
      m.migration_template 'migrations/combined_v1.rb', "db/migrate", :migration_file_name => "create_geography_tables"
      #m.migration_template 'migrations/continents.rb', "db/migrate", :migration_file_name => "create_continents"
      #m.migration_template 'migrations/countries.rb', "db/migrate", :migration_file_name => "create_countries"
      #m.migration_template 'migrations/states.rb', "db/migrate", :migration_file_name => "create_states"
      #m.migration_template 'migrations/regions.rb', "db/migrate", :migration_file_name => "create_regions"
      #m.migration_template 'migrations/counties.rb', "db/migrate", :migration_file_name => "create_counties"

    end
  end

  private
    def custom_file_name
      custom_name = class_name.underscore.downcase
      custom_name = custom_name.pluralize if ActiveRecord::Base.pluralize_table_names
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
welike-geography-0.0.3 generators/geography/geography_generator.rb