lib/generators/rating/install_generator.rb in rating-0.4.0 vs lib/generators/rating/install_generator.rb in rating-0.5.0

- old
+ new

@@ -2,18 +2,23 @@ module Rating class InstallGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) - desc 'creates Rating migration' + desc 'Creates Rating migration' def create_migration - template 'db/migrate/create_rating_tables.rb', "db/migrate/#{timestamp}_create_rating_tables.rb" + template 'db/migrate/create_rating_table.rb', "db/migrate/#{timestamp(0)}_create_rating_table.rb" + template 'db/migrate/create_rate_table.rb', "db/migrate/#{timestamp(1)}_create_rate_table.rb" end private - def timestamp - Time.current.strftime '%Y%m%d%H%M%S' + def time + @time ||= Time.current + end + + def timestamp(seconds) + (time + seconds.seconds).strftime '%Y%m%d%H%M%S' end end end