Sha256: 281dd5fc4dd7b00caeccfe6907b6e9878c6d9efd54b3e9565ffc90e025b273de
Contents?: true
Size: 756 Bytes
Versions: 28
Compression:
Stored size: 756 Bytes
Contents
module Mongoid #:nodoc: module Associations #:nodoc: module Decorator #:nodoc: def self.included(base) base.class_eval do attr_reader :document # Grabs all the public methods on the document and adds them # to the association class. This is preferred over method_missing # since we can ask the class for its methods and get an # accurate list. def decorate! document.public_methods(false).each do |method| (class << self; self; end).class_eval do define_method method do |*args| document.send method, *args end end end end end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems