Sha256: 80d5871620a1f399a7164746b90f1dffac5812579f15074a171c93d1a427db98

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

# encoding: utf-8

module Uncharted

  class Country
    include Mongoid::Fields::Serializable if defined? Mongoid

    def deserialize(code)
      code && Country.find(code)
    end

    def serialize(country)
      country && country.code
    end
  end

  class Territory
    include Mongoid::Fields::Serializable if defined? Mongoid

    def deserialize(code)
      code && Territory.find(code)
    end

    def serialize(territory)
      territory && territory.code
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uncharted-0.0.11 lib/uncharted/extensions/mongoid.rb
uncharted-0.0.10 lib/uncharted/extensions/mongoid.rb