Sha256: 72a027fc9d95d006bd83219761b78c01d73d7f915c02f8f025d42af0faf78a1d

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

module Id
  module Form
    class ActiveModelForm
      include ActiveModel::Validations
      include ActiveModel::Conversion
      extend  ActiveModel::Naming

      def self.i18n_scope
        :id
      end

      def initialize(model)
        @model = model
      end

      def persisted?
        false
      end

      def to_model
        self
      end

      private

      def method_missing(name, *args, &block)
        model.send(name, *args, &block)
      end

      def memoize(f, &b)
        instance_variable_get("@#{f}") || instance_variable_set("@#{f}", b.call)
      end

      attr_reader :model
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
id-0.0.11 lib/id/form/active_model_form.rb
id-0.0.10 lib/id/form/active_model_form.rb