Sha256: 04bf0b6357a138eb1b6681437e68ecfd43835fd284f321f4397dbf06099f2480

Contents?: true

Size: 301 Bytes

Versions: 3

Compression:

Stored size: 301 Bytes

Contents

module Id
  module Model
    class HasMany < Association

      def define_getter
        field = self
        model.send :define_method, name do
          memoize field.name do
            data.fetch(field.key, []).map { |r| field.type.new(r) }
          end
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
id-0.0.9 lib/id/model/has_many.rb
id-0.0.8 lib/id/model/has_many.rb
id-0.0.7 lib/id/model/has_many.rb