Sha256: 00e607f41a02c5c6e43255b8f43f764e58a5d6cfa267dea910dc20028307f137

Contents?: true

Size: 307 Bytes

Versions: 6

Compression:

Stored size: 307 Bytes

Contents

module Id
  module Model
    class HasOne < Association

      def define
        field = self
        model.send :define_method, name do
          memoize field.name do
            field.type.new(data.fetch(field.key) { raise MissingAttributeError })
          end
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
id-0.0.6 lib/id/model/has_one.rb
id-0.0.5 lib/id/model/has_one.rb
id-0.0.4 lib/id/model/has_one.rb
id-0.0.3 lib/id/model/has_one.rb
id-0.0.2 lib/id/model/has_one.rb
id-0.0.1 lib/id/model/has_one.rb