Ruby 2 (not 1.9.3) specific issue with AR when calling alias_method'd destroy vs. super in module-included instance destroy

Showing 1-3 of 3 messages
Ruby 2 (not 1.9.3) specific issue with AR when calling alias_method'd destroy vs. super in module-included instance destroy Gary Weaver 12/6/13 9:12 AM

There is probably a simple reason for this, but haven't figured it out yet.

If you alias_method destroy on an AR model and then call that method from a module included destroy, it works fine in Ruby 1.9.3 but not Ruby 2.0.0-p247.

The workaround is to call super instead. I'm curious as to why this depends on the Ruby version.

Here is the project to reproduce. I know it is a fringe usage case:

https://github.com/garysweaver/fun_20131206

Thanks

Re: [Rails-core] Ruby 2 (not 1.9.3) specific issue with AR when calling alias_method'd destroy vs. super in module-included instance destroy Akira Matsuda 12/10/13 8:14 AM
Thank you for a fun report Gary!

We drilled down the problem and we actually could reproduce the same behavior "off Rails".
So I just filed an issue on the Ruby bug tracker. http://bugs.ruby-lang.org/issues/9236
I guess you hit a hidden Ruby bug!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.



--
Akira Matsuda<ron...@dio.jp>
Re: [Rails-core] Ruby 2 (not 1.9.3) specific issue with AR when calling alias_method'd destroy vs. super in module-included instance destroy Akira Matsuda 12/13/13 5:14 PM
And the bug was just fixed via r44175. https://github.com/ruby/ruby/commit/b71956d12b061613f8ef9dfe3f8a75e56dfa799d
So your code would work under Ruby 2.1 which will be shipped at Christmas this month :)

Thanks!
--
Akira Matsuda<ron...@dio.jp>