15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/generators/interactive/model/model_generator.rb', line 15
def add_model
say "Starting interactive Model generator", [:bold, :magenta]
cmd = ["rails #{self.behavior == :invoke ? 'generate' : 'destroy'} model"]
model_name = prompt.ask("\nWhat is the great name of your model?", required: true) { |q| q.modify :remove }
cmd << model_name
if prompt.select("\nSkip migration?", boolean_choices)
cmd << "--no-migration"
else
cmd += select_columns_configuration
cmd << "--no-timestamps" if prompt.select("\nSkip created_at, updated_at timestamps?", boolean_choices)
cmd << "--no-indexes" if prompt.select("\nSkip indexes?", boolean_choices)
end
run cmd.join(" ")
end
|