Created
December 8, 2012 15:48
-
-
Save the8472/4240807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mhmr::DescendantsTracker | |
def descendants_and_self | |
[self].concat self.descendants | |
end | |
end | |
ActiveSupport::DescendantsTracker.send(:include,Mhmr::DescendantsTracker) | |
jruby: | |
ActiveRecord::Base.descendants # works | |
ActiveRecord::Base.descendants_and_self # throws | |
NoMethodError: undefined method `descendants_and_self' for ActiveRecord::Base:Class | |
from org/jruby/RubyBasicObject.java:1652:in `method_missing' | |
from /home/aaron/.rvm/gems/jruby-head@mhmr/gems/activerecord-3.2.9/lib/active_record/dynamic_matchers.rb:50:in `method_missing' | |
from (irb):8:in `evaluate' | |
from org/jruby/RubyKernel.java:1066:in `eval' | |
from org/jruby/RubyKernel.java:1392:in `loop' | |
from org/jruby/RubyKernel.java:1174:in `catch' | |
from org/jruby/RubyKernel.java:1174:in `catch' | |
from /home/aaron/.rvm/gems/jruby-head@mhmr/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start' | |
from /home/aaron/.rvm/gems/jruby-head@mhmr/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start' | |
from /home/aaron/.rvm/gems/jruby-head@mhmr/gems/railties-3.2.9/lib/rails/commands.rb:41:in `(root)' | |
from org/jruby/RubyKernel.java:1027:in `require' | |
from script/rails:6:in `(root)' | |
ActiveRecord::Base.__metaclass__.ancestors.map(&:name).compact.select{|n| n["Des"]} | |
=> ["ActiveSupport::DescendantsTracker"] | |
mri193: | |
ActiveRecord::Base.descendants # works | |
ActiveRecord::Base.descendants_and_self # works | |
ActiveRecord::Base.__metaclass__.ancestors.map(&:name).compact.select{|n| n["Des"]} | |
=> ["ActiveSupport::DescendantsTracker", "Mhmr::DescendantsTracker"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment