Sha256: 4be8fddebc22434e1c72e05908278d384e4c5f5b72cbaf040dec6a5aad54efe2
Contents?: true
Size: 911 Bytes
Versions: 2
Compression:
Stored size: 911 Bytes
Contents
require 'rails/generators' require 'rails/generators/migration' module RailsSettings class MigrationGenerator < Rails::Generators::Base include Rails::Generators::Migration desc 'Generates migration for rails-settings' source_root File.expand_path('../templates', __FILE__) def create_migration_file migration_template 'migration.rb', 'db/migrate/rails_settings_migration.rb' end def self.next_migration_number(dirname) if timestamped_migrations? Time.now.utc.strftime('%Y%m%d%H%M%S') else '%.3d' % (current_migration_number(dirname) + 1) end end def self.timestamped_migrations? (ActiveRecord::Base.respond_to?(:timestamped_migrations) && ActiveRecord::Base.timestamped_migrations) || (ActiveRecord.respond_to?(:timestamped_migrations) && ActiveRecord.timestamped_migrations) end end end
Version data entries
2 entries across 2 versions & 1 rubygems