Class: Cabalist::ClassifierGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Cabalist::ClassifierGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/cabalist/classifier/classifier_generator.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
Class Method Details
+ (Object) next_migration_number(dirname)
15 16 17 |
# File 'lib/generators/cabalist/classifier/classifier_generator.rb', line 15 def self.next_migration_number(dirname) Time.now.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
- (Object) add_to_gui_if_necessary
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/cabalist/classifier/classifier_generator.rb', line 24 def add_to_gui_if_necessary add_to_gui = '' until %w(y Y n N).include?(add_to_gui) add_to_gui = ask "Would you like to have access to this model through GUI dashboard? (Y/n) " end if %w(Y y).include?(add_to_gui) inject_into_file "config/initializers/cabalist.rb", "\n c.frontend_classes << #{name}", :before => "\nend" end end |
- (Object) create_migration
19 20 21 22 |
# File 'lib/generators/cabalist/classifier/classifier_generator.rb', line 19 def create_migration migration_template("migrations/add_cabalist.rb.erb", "db/migrate/add_cabalist_to_#{name.tableize}.rb") end |