Sha256: cd0c3ac80a64649c748bf8275a26e89e551df4acf2b1d04500ba5f32654ff834

Contents?: true

Size: 633 Bytes

Versions: 16

Compression:

Stored size: 633 Bytes

Contents

require 'rails/generators'
require 'rails/generators'
require 'rails/generators/migration'

# @private
class MetadataGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  
  source_root "#{File.dirname __FILE__}/../../templates"
  
  def self.next_migration_number(dirname)
    if ActiveRecord::Base.timestamped_migrations then
      Time.now.utc.strftime "%Y%m%d%H%M%S"
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end
  
  def copy_files
    copy_file "metadata.rb", "app/models/metadata.rb"
    migration_template "create_metadata.rb", "db/migrate/create_metadata.rb"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
has_metadata-1.6.1 lib/has_metadata/metadata_generator.rb
has_metadata-1.5.4 lib/has_metadata/metadata_generator.rb
has_metadata-1.2.4 lib/has_metadata/metadata_generator.rb
has_metadata-1.5.3 lib/has_metadata/metadata_generator.rb
has_metadata-1.2.3 lib/has_metadata/metadata_generator.rb
has_metadata-1.6.0 lib/has_metadata/metadata_generator.rb
has_metadata-1.5.2 lib/has_metadata/metadata_generator.rb
has_metadata-1.5.1 lib/has_metadata/metadata_generator.rb
has_metadata-1.5.0 lib/has_metadata/metadata_generator.rb
has_metadata-1.4.0 lib/has_metadata/metadata_generator.rb
has_metadata-1.3.0 lib/has_metadata/metadata_generator.rb
has_metadata-1.2.2 lib/has_metadata/metadata_generator.rb
has_metadata-1.2.1 lib/has_metadata/metadata_generator.rb
has_metadata-1.2.0 lib/has_metadata/metadata_generator.rb
has_metadata-1.1.1 lib/has_metadata/metadata_generator.rb
has_metadata-1.1.0 lib/has_metadata/metadata_generator.rb