24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/generators/effective/migration_generator.rb', line 24
def create_migration
if invoked_attributes.present?
Rails::Generators.invoke('migration', ["create_#{plural_name}"] + (invokable(invoked_attributes) | timestamps))
elsif resource.klass_attributes.present?
raise 'klass_attributes already exist. We cant migrate (yet). Exiting.'
elsif resource.written_attributes.present?
Rails::Generators.invoke('migration', ["create_#{plural_name}"] + invokable(resource.belong_tos_attributes) + (invokable(resource.written_attributes) | timestamps))
else
raise 'You need to specify some attributes or have a model file present'
end
end
|