Sha256: 9fad94f36efb8057d5f521d623b4ed50ab6b4f3a395b421e0023abb08b34e2a0

Contents?: true

Size: 661 Bytes

Versions: 3

Compression:

Stored size: 661 Bytes

Contents

module Administrate
  module Generators
    class FieldGenerator < Rails::Generators::NamedBase
      source_root File.expand_path("../templates", __FILE__)

      def template_field_object
        template(
          "field_object.rb.erb",
          "app/fields/#{file_name}_field.rb"
        )
      end

      def copy_partials
        copy_partial(:show)
        copy_partial(:index)
        copy_partial(:form)
      end

      private

      def copy_partial(partial_name)
        partial = "_#{partial_name}.html.erb"

        copy_file(
          partial,
          "app/views/fields/#{file_name}_field/#{partial}"
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
administrate-1.0.0.beta3 lib/generators/administrate/field/field_generator.rb
administrate-1.0.0.beta2 lib/generators/administrate/field/field_generator.rb
administrate-1.0.0.beta1 lib/generators/administrate/field/field_generator.rb