Class: Fabrication::Generators::ModelGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/rails/generators/fabrication/model/model_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



21
22
23
# File 'lib/rails/generators/fabrication/model/model_generator.rb', line 21

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#create_fabrication_fileObject



11
12
13
14
15
16
17
18
19
# File 'lib/rails/generators/fabrication/model/model_generator.rb', line 11

def create_fabrication_file
  copy_attributes_from_model if attributes.empty?
  template_file = File.join(
    options[:dir],
    class_path,
    "#{file_name}_fabricator.#{options[:extension]}"
  )
  template 'fabricator.erb', template_file
end