Sha256: a4ef3c62130dbe8b800bafa8fd1a5fe731358576b4bef7da2379da822b92d9d3
Contents?: true
Size: 793 Bytes
Versions: 2
Compression:
Stored size: 793 Bytes
Contents
# encoding: utf-8 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid-0.9.6 | lib/mongoid/associations/decorator.rb |
mongoid-0.9.5 | lib/mongoid/associations/decorator.rb |