Sha256: f247b256f953686be0b2241931fab9ed4de308f1d927a7c6f10f7af1b0be5a6f
Contents?: true
Size: 560 Bytes
Versions: 33
Compression:
Stored size: 560 Bytes
Contents
module Mongoid module Fields module LocalizedDefaults def create_accessors(name, meth, options = {}) super if options[:localize] field = fields[name] define_method meth do |*args| result = super(*args) return result unless result.nil? default_name = field.send(:default_name) return send(default_name) if respond_to?(default_name) field.default_val end end end end ClassMethods.prepend(LocalizedDefaults) end end
Version data entries
33 entries across 33 versions & 1 rubygems