refactor generator

main
Washington Botelho 2017-11-02 13:30:22 -02:00
parent 656f2785fa
commit dd1c8e2dd2
No known key found for this signature in database
GPG Key ID: BECE10A8106CC7A0
1 changed files with 7 additions and 3 deletions

View File

@ -4,12 +4,16 @@ module Rating
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
desc 'configure Rating'
desc 'creates Rating migration'
def create_migration
version = Time.current.strftime('%Y%m%d%H%M%S')
template 'db/migrate/create_rating_tables.rb', "db/migrate/#{timestamp}_create_rating_tables.rb"
end
template 'db/migrate/create_rating_tables.rb', "db/migrate/#{version}_create_rating_tables.rb"
private
def timestamp
Time.current.strftime '%Y%m%d%H%M%S'
end
end
end