From 9479ba6495975b493300a54505d4c54f87f8d4c8 Mon Sep 17 00:00:00 2001 From: Davide D'Agostino Date: Fri, 24 Sep 2010 12:35:59 +0200 Subject: [PATCH] [padrino-admin] Fix an issue with skip_migrations and destroy. --- .../lib/padrino-admin/generators/admin_app.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/padrino-admin/lib/padrino-admin/generators/admin_app.rb b/padrino-admin/lib/padrino-admin/generators/admin_app.rb index d099ba2b8..047db077b 100644 --- a/padrino-admin/lib/padrino-admin/generators/admin_app.rb +++ b/padrino-admin/lib/padrino-admin/generators/admin_app.rb @@ -46,10 +46,15 @@ def create_admin directory "templates/app", destination_root("admin") directory "templates/assets", destination_root("public", "admin") - Padrino::Generators::Model.start([ + account_params = [ "account", "name:string", "surname:string", "email:string", "crypted_password:string", "salt:string", "role:string", - "-r=#{options[:root]}", "-s=#{options[:skip_migration]}", "-d=#{options[:destroy]}" - ]) + "-r=#{options[:root]}" + ] + + account_params << "-s" if options[:skip_migration] + account_params << "-d" if options[:destroy] + + Padrino::Generators::Model.start(account_params) column = Struct.new(:name, :type) columns = [:id, :name, :surname, :email].map { |col| column.new(col) }