Class: Mexican::States::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mexican::States::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/mexican/states/install_generator.rb
Overview
Install generator class
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
14 15 16 17 |
# File 'lib/generators/mexican/states/install_generator.rb', line 14 def self.next_migration_number(path) next_migration_number = current_migration_number(path) + 1 ActiveRecord::Migration.next_migration_number(next_migration_number) end |
Instance Method Details
#copy_migrations ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/mexican/states/install_generator.rb', line 20 def copy_migrations migration_template '../migrations/create_states.rb', 'db/migrate/create_states.rb' migration_template '../migrations/create_cities.rb', 'db/migrate/create_cities.rb' migration_template '../migrations/create_neighborhoods.rb', 'db/migrate/create_neighborhoods.rb' rake 'db:migrate' end |
#copy_models ⇒ Object
31 32 33 34 35 |
# File 'lib/generators/mexican/states/install_generator.rb', line 31 def copy_models copy_file './models/state.rb', 'app/models/state.rb' copy_file './models/city.rb', 'app/models/city.rb' copy_file './models/neighborhood.rb', 'app/models/neighborhood.rb' end |