Class: ValidationErrors::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/validation_errors/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

Implement the required interface for Rails::Generators::Migration.



14
15
16
17
# File 'lib/generators/validation_errors/install_generator.rb', line 14

def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#copy_migrationsObject



20
21
22
23
24
25
26
27
28
# File 'lib/generators/validation_errors/install_generator.rb', line 20

def copy_migrations
  migration_template "create_validation_errors_table.rb", "db/migrate/create_validation_errors_table.rb"
  if defined?(Scenic)
    migration_template "create_flat_validation_errors.rb", "db/migrate/create_flat_validation_errors.rb"
    copy_file "flat_validation_errors_v01.sql", "db/views/flat_validation_errors_v01.sql"
  else
    puts "Scenic is not installed so we will skip the creation of the flat_validation_errors view.\nCheck the README for more information."
  end
end