Class: ModelGen::CreateModelGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/model_gen/create_model/create_model_generator.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
# File 'lib/generators/model_gen/create_model/create_model_generator.rb', line 6

def create
  command = "rails g model #{name.downcase}"
  attributes.each do |field|
    command = command + " #{field.name.downcase}:#{field.type.downcase}"
  end
  system command
  system 'rake db:migrate'
end