Sha256: 6b235167bffcb56607f84f7f2f2e214c78ce1d3e4b2c30787fc8891411ff9699

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

module Headmin
  class FieldsGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    source_root File.expand_path('../../templates', __FILE__)

    def blocks
      template 'models/field.rb', 'app/models/field.rb'
      migration_template 'migrations/create_fields.rb', 'db/migrate/create_fields.rb'
      migration_template 'migrations/create_field_hierarchies.rb', 'db/migrate/create_field_hierarchies.rb'
    end

    private

    def self.next_migration_number(dirname)
      next_migration_number = current_migration_number(dirname) + 1
      ActiveRecord::Migration.next_migration_number(next_migration_number)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.2.5 lib/generators/headmin/fields_generator.rb
headmin-0.2.4 lib/generators/headmin/fields_generator.rb