Class: FlashcardGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- FlashcardGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/flashcard/flashcard_generator.rb
Instance Method Summary collapse
Instance Method Details
#install_flashcards ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/flashcard/flashcard_generator.rb', line 11 def install_flashcards if File.exist?("#{destination_root}/db/schema.rb") && File.read("#{destination_root}/db/schema.rb") =~ /create_table \"#{table_name}\"/ migration_template( 'add_fields_migration.rb', "db/migrate/add_flashcard_fields_to_#{table_name}.rb") else migration_template('create_table_migration.rb', "db/migrate/create_#{table_name}.rb") end end |