evilmartians / evil-seed

A Gem for creating partial anonymized dumps of your database using your app model relations.
MIT License
447 stars 19 forks source link

Rails 4.2.x and jruby compatibility #6

Closed andyatkinson closed 2 years ago

andyatkinson commented 5 years ago

Hello. In our Rails 4.2.11 app on jruby 9.2.5.0, I'm seeing the following error. I put some print statements into the refinements configuration code that back ports the in_batches method to ActiveRecord::Relation in Rails 4.2, and they print out as expected. So I'm not sure why this isn't available at runtime. This error happens on a simple usage based on the documentation, trying to navigate the first configured model's associations.

NoMethodError: undefined method `in_batches' for #<User::ActiveRecord_Relation:0x39352f6b>

Do you know if refinements work in jruby?

It appears that may not be the case, which was surprising. (still investigating) https://github.com/jruby/jruby/issues/4330

andyatkinson commented 5 years ago

Would find_in_batches in relation dumper work as a workaround?

andyatkinson commented 5 years ago

It seems that find_in_batches causes a different problem with an invalid SQL query, order by clause, so it doesn't seem like a viable workaround.

palkan commented 5 years ago

@andyatkinson did this work in jRuby 9.1.15.0? I've just found that there is a regression related to Refinements( My refined code worked fine in 9.2.15.0, but doesn't work in 9.2.5.0 (https://travis-ci.org/palkan/anyway_config/builds/475861744) /cc @Envek

palkan commented 5 years ago

nvm, I found another JRuby bug )

Envek commented 2 years ago

In last 3 years JRuby has improved its Refinements support a lot. At the same time ActiveRecord 4.2 got way past its end-of-life. Closing.