Sha256: 070dea44717db852b81ec04689646e49f3714eba084e4e0f0715b92471d2448d
Contents?: true
Size: 674 Bytes
Versions: 1
Compression:
Stored size: 674 Bytes
Contents
require 'mongo_mapper' require 'mongo_mapper/plugins' require 'mongo_mapper/strict_keys/version' require 'mongo_mapper/strict_keys/bang' module MongoMapper module Plugins module StrictKeys extend ActiveSupport::Concern module ClassMethods; end module InstanceMethods def ensure_key_exists(name) unless respond_to?("#{name}=") raise ArgumentError.new("Attribute '#{name}' has not been explicitly defined as a key.") end end end end end end MongoMapper::Document.plugin(MongoMapper::Plugins::StrictKeys::Bang) MongoMapper::EmbeddedDocument.plugin(MongoMapper::Plugins::StrictKeys::Bang)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo_mapper-strict_keys-0.0.4 | lib/mongo_mapper/strict_keys.rb |