Class: RedPotion::Generators::CDQModel

Inherits:
Thor::Group
  • Object
show all
Includes:
ModelGeneratorMethods, Thor::Actions
Defined in:
lib/redpotion/generators/cdq_model.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ModelGeneratorMethods

#check_for_previous_schema!, #new_schema_number, #previous_schema_content, #previous_schema_filename, #previous_schema_number

Class Method Details

.source_rootObject



12
13
14
# File 'lib/redpotion/generators/cdq_model.rb', line 12

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#generateObject



16
17
18
19
20
# File 'lib/redpotion/generators/cdq_model.rb', line 16

def generate
  template "templates/cdq_model.tt", "app/models/#{model_name}.rb"
  check_for_previous_schema!
  template "templates/cdq_migration.tt", "schemas/#{new_schema_number}_create_#{model_name.underscore}.rb"
end