Class: HorsePower::ModelGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/horse_power/model/model_generator.rb

Instance Method Summary collapse

Instance Method Details

#sprintObject



8
9
10
11
12
13
14
15
16
# File 'lib/generators/horse_power/model/model_generator.rb', line 8

def sprint
	template "model.rb.erb", "app/models/#{HorsePower.get_singular(resource_name)}.rb"
	# We only need this to create the migration
	if api_version == "1"
		run "rails g model #{HorsePower.get_singular(resource_name)} #{attributes.join(" ")} --no-fixture --skip"
	  run "rm -rf spec/factories/#{HorsePower.get_plural(resource_name)}.rb"
     run "rm -rf spec/models/#{HorsePower.get_singular(resource_name)}_spec.rb"
   end
end