Class: Merb::Generators::ModelGenerator

Inherits:
NamespacedGenerator show all
Defined in:
lib/generators/model.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NamespacedGenerator

#base_path, #class_name, #file_name, #full_class_name, #modules

Methods inherited from NamedGenerator

#class_name, #file_name, #initialize, #symbol_name, #test_class_name

Methods inherited from Generator

#go_up, #initialize, #with_modules

Methods included from ColorfulMessages

#error, #success, #warning

Constructor Details

This class inherits a constructor from Merb::Generators::NamedGenerator

Class Method Details

.source_rootObject



6
7
8
# File 'lib/generators/model.rb', line 6

def self.source_root
  File.join(super, 'component', 'model')
end

Instance Method Details

#after_generationObject



44
45
46
# File 'lib/generators/model.rb', line 44

def after_generation
  STDOUT.puts "\n\nDon't forget to add model tests first."
end

#attributes?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/generators/model.rb', line 36

def attributes?
  self.attributes && !self.attributes.empty?
end

#attributes_for_accessorObject



40
41
42
# File 'lib/generators/model.rb', line 40

def attributes_for_accessor
  self.attributes.keys.map{|a| ":#{a}" }.compact.uniq.join(", ")
end