Class: ActiveRecord::ScaffoldhubGenerator

Inherits:
Generators::ModelGenerator
  • Object
show all
Includes:
Scaffoldhub::Helper
Defined in:
lib/generators/active_record/scaffoldhub_generator.rb

Instance Method Summary collapse

Methods included from Scaffoldhub::Helper

#download_scaffold_spec!, #each_gem, #each_template_file, #find_template_file, included, #post_install_message, #replace_name_tokens, #scaffold_name, #scaffold_parameter, #scaffold_spec, scaffold_spec, scaffold_spec=, #status_proc

Instance Method Details

#create_migration_fileObject



24
25
26
27
28
29
# File 'lib/generators/active_record/scaffoldhub_generator.rb', line 24

def create_migration_file
  return unless options[:migration] && options[:parent].nil?
  find_template_file(:migration) do |migration_template|
    migration_template migration_template.src, "db/migrate/create_#{table_name}.rb"
  end
end

#create_model_fileObject



18
19
20
21
22
# File 'lib/generators/active_record/scaffoldhub_generator.rb', line 18

def create_model_file
  find_template_file(:model) do |model_template|
    template model_template.src, File.join('app/models', class_path, "#{file_name}.rb")
  end
end