Sha256: cfaf1016d1f0c0b4daab8efca1c83133316f3076599938d3479be3731b2a8605

Contents?: true

Size: 700 Bytes

Versions: 6

Compression:

Stored size: 700 Bytes

Contents

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

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

    def copy_models
      template 'models/field.rb', 'app/models/field.rb'
    end

    def copy_migrations
      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

6 entries across 6 versions & 1 rubygems

Version Path
headmin-0.2.9 lib/generators/headmin/fields_generator.rb
headmin-0.3.2 lib/generators/headmin/fields_generator.rb
headmin-0.3.1 lib/generators/headmin/fields_generator.rb
headmin-0.2.8 lib/generators/headmin/fields_generator.rb
headmin-0.2.7 lib/generators/headmin/fields_generator.rb
headmin-0.2.6 lib/generators/headmin/fields_generator.rb