Sha256: 7dbb3a2cb03a0ae24d3c601bc24d2a49be923ac099b108508f773002c29355df

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

module Id
  module Form
    module Descriptor

      def field(f, options={})
        FieldWithFormSupport.new(self, f, options).define
      end

      def form &block
        form_object.send :instance_exec, &block
      end

      def form_object
        base = self
        @form_object ||= Class.new(ActiveModelForm) do
          eingenclass = class << self
            self
          end
          eingenclass.send(:define_method, :model_name) do
            ActiveModel::Name.new(self, nil, base.name)
          end
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
id-0.0.12 lib/id/form/descriptor.rb
id-0.0.11 lib/id/form/descriptor.rb
id-0.0.10 lib/id/form/descriptor.rb