pat / after_commit

A Ruby on Rails plugin to add an after_commit callback. This can be used to trigger things only after the entire transaction is complete.
MIT License
62 stars 32 forks source link

Fixed compatibility with JRuby. #4

Closed nirvdrum closed 13 years ago

nirvdrum commented 13 years ago

The JRuby ActiveRecord adapters use a different method for initiating a transaction. This patch just does some simple introspection and chains the correct method.

pat commented 13 years ago

Thanks Kevin, just merged it in, will release a new gem version soon :)

pat commented 13 years ago

(Hmm, seems I hit close before the push came through - now Github doesn't think it's merged. But it is! Honest! ;)

And got the new gem release pushed as well - 1.0.9. Thanks!

nirvdrum commented 13 years ago

Great. Thanks for the quick turnaround.

pat commented 13 years ago

Hi Kevin

Just wondering - have you tested these changes against MRI? I've had a few people say 1.0.9 doesn't work for them (breaks their tests), and am trying to figure out which commits are at fault. You're probably going to have your head around this code far better than myself - if you have the chance to check, that'd be fantastic.

nirvdrum commented 13 years ago

I actually run in REE almost exclusively right now, with 1.0.9, and have had no problems. I'm still in the midst of migrating to JRuby, but I was pretty keen on making sure it worked with the C-based Ruby I was using.

Perhaps it's adapter-specific? I did only test on PostgreSQL, but it didn't seem like the transaction call was adapter-specific to begin with.

pat commented 13 years ago

Ah, maybe that's it... do you have MySQL installed and can try it out? I should be able to at some point otherwise...

The TS ticket that's prompted this: https://github.com/freelancing-god/after_commit/issues/5