Class: ExceptionHandler::MigrationGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- ExceptionHandler::MigrationGenerator
- Defined in:
- lib/generators/exception_handler/migration_generator.rb
Instance Method Summary collapse
-
#create_errors_migration ⇒ Object
> Create.
-
#migration_version ⇒ Object
> Migration Version.
-
#rails5? ⇒ Boolean
> Rails 5?.
-
#table_name ⇒ Object
> Table Name - false = off, true = errors, value = value => Always outputs string for some reason…
Instance Method Details
#create_errors_migration ⇒ Object
> Create
31 32 33 |
# File 'lib/generators/exception_handler/migration_generator.rb', line 31 def create_errors_migration migration_template "migration.rb.erb", "db/migrate/create_#{table_name.to_s.gsub("_","")}.rb", migration_version: migration_version end |
#migration_version ⇒ Object
> Migration Version
46 47 48 49 50 |
# File 'lib/generators/exception_handler/migration_generator.rb', line 46 def migration_version if rails5? "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end |
#rails5? ⇒ Boolean
> Rails 5?
41 42 43 |
# File 'lib/generators/exception_handler/migration_generator.rb', line 41 def rails5? Rails.version.start_with? '5' end |
#table_name ⇒ Object
> Table Name - false = off, true = errors, value = value
> Always outputs string for some reason…
24 25 26 |
# File 'lib/generators/exception_handler/migration_generator.rb', line 24 def table_name ExceptionHandler.config.db end |