class FlashcardGenerator

Public Instance Methods

install_flashcards() click to toggle source
# File lib/generators/flashcard/flashcard_generator.rb, line 11
def install_flashcards
  if schema_exists? && 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

Private Instance Methods

schema_exists?() click to toggle source
# File lib/generators/flashcard/flashcard_generator.rb, line 21
def schema_exists?
  File.exist?("#{destination_root}/db/schema.rb")
end