Sha256: 62b4be3d729da5a92fbfde6ad2cdb30efb31c2bd18e58cd600a8b6469c84a804
Contents?: true
Size: 775 Bytes
Versions: 28
Compression:
Stored size: 775 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! meths = document.public_methods meths.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