Class: CircuitSwitch::MigrationGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- CircuitSwitch::MigrationGenerator
- Defined in:
- lib/generators/circuit_switch/migration_generator.rb
Instance Method Summary collapse
Instance Method Details
#generate_migration ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/circuit_switch/migration_generator.rb', line 11 def generate_migration case migration_type when ['add_key'] migration_template 'add_key.rb.erb', 'db/migrate/add_key_to_circuit_switches.rb', migration_version: migration_version when ['make_key_unique'] migration_template 'make_key_unique.rb.erb', 'db/migrate/make_key_unique_for_circuit_switches.rb', migration_version: migration_version else migration_template 'migration.rb.erb', 'db/migrate/create_circuit_switches.rb', migration_version: migration_version end end |
#migration_version ⇒ Object
22 23 24 25 26 |
# File 'lib/generators/circuit_switch/migration_generator.rb', line 22 def migration_version if ActiveRecord::VERSION::MAJOR >= 5 "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end |