Class: Github::Ds::Generators::ActiveRecordGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Github::Ds::Generators::ActiveRecordGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/github/ds/active_record_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.migration_version ⇒ Object
20 21 22 23 24 |
# File 'lib/generators/github/ds/active_record_generator.rb', line 20 def self.migration_version if Rails.version.start_with?('5') "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end |
.next_migration_number(dirname) ⇒ Object
16 17 18 |
# File 'lib/generators/github/ds/active_record_generator.rb', line 16 def self.next_migration_number(dirname) ::ActiveRecord::Generators::Base.next_migration_number(dirname) end |
Instance Method Details
#create_migration_file ⇒ Object
12 13 14 |
# File 'lib/generators/github/ds/active_record_generator.rb', line 12 def create_migration_file migration_template "migration.rb", "db/migrate/create_key_values_table.rb", migration_version: migration_version end |
#migration_version ⇒ Object
26 27 28 |
# File 'lib/generators/github/ds/active_record_generator.rb', line 26 def migration_version self.class.migration_version end |
#table_name ⇒ Object
34 35 36 |
# File 'lib/generators/github/ds/active_record_generator.rb', line 34 def table_name self.class.table_name end |