Sha256: d8d6281d437218cc098b5ee139eaba2efb543dff918332d9c27c8874360896ae

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true

require "rails/generators"

module ActiveFields
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      desc "This generator creates an create_initializer and copies plugin migrations"

      def create_initializer
        initializer "active_fields.rb", <<~RUBY
          ActiveFields.configure do |config|
            # Change fields base class:
            # config.field_base_class_name = "CustomField"
            # Change value class:
            # config.value_class_name = "CustomValue"

            # Register custom field type:
            # config.register_field :ip, "IpField"
          end
        RUBY
      end

      def install_migrations
        rails_command "active_fields:install:migrations"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_fields-1.0.0 lib/generators/active_fields/install/install_generator.rb