Sha256: b82746dc6fc0c324bd87a8caf20bb5e084feaabe5285cfcc98defac67314bfe6
Contents?: true
Size: 937 Bytes
Versions: 2
Compression:
Stored size: 937 Bytes
Contents
require 'rails/generators' require 'rails/generators/migration' module OldSql class InstallDeviseMigrationsGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) argument :model_name, :type => :string, :default => 'user' def self.next_migration_number(dirname) if ActiveRecord::Base.timestamped_migrations migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i migration_number += 1 migration_number.to_s else "%.3d" % (current_migration_number(dirname) + 1) end end def create_migration_file gsub_file 'add_devise_to_users_migration.rb', /users/, "#{model_name}" migration_template 'add_devise_to_users_migration.rb', "db/migrate/add_devise_to_#{model_name}.rb" rescue p $!.message #sleep 1 # ensure scripts have different timestamps end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
old_sql-1.38.0 | lib/generators/old_sql/install_devise_migrations_generator.rb |
old_sql-1.37.0 | lib/generators/old_sql/install_devise_migrations_generator.rb |