Sha256: 4fa4f4468e0b23e5f1d85d39e14c6e7dbcd2258c3fe6cdd53658be4067f40ae7

Contents?: true

Size: 419 Bytes

Versions: 3

Compression:

Stored size: 419 Bytes

Contents

# @see https://github.com/mongoid/mongoid/blob/master/lib/mongoid/factory.rb#L39
module Mongoid
  module Factory
    old_from_db = instance_method(:from_db)

    define_method(:from_db) do |klass, attributes=nil, criteria_instance_id=nil|
      attributes.delete('_type') if attributes && klass.name.deconstantize == 'Popolo'
      old_from_db.bind(self).call(klass, attributes, criteria_instance_id)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
popolo-0.1.1 lib/popolo/initializers/pupa_compat.rb
popolo-0.1.0 lib/popolo/initializers/pupa_compat.rb
popolo-0.0.3 lib/popolo/initializers/pupa_compat.rb