Upgrading from Rails 3.1 to 3.2 gets NoMethodError for unserializable_attribute?, using JRuby, Oracle and binary data

StackOverflow https://stackoverflow.com/questions/9223041

Question

I have a simple Rails 3.1 CRUD app built using Oracle running on JRuby. The model class has an attribute with binary data stored in an Oracle blob column.

All works well on 3.1, but when run with Rails 3.2, it throws NoMethodError looking for unserializable_attribute?. I can go back to 3.2 without changing anything else, so its pretty clearly something associated with the change in rails version.

unserializable_attribute? is called from the file activerecord-jdbc-adapter-1.2.2/lib/arjdbc/oracle/adaptor.rb

From grepping the source, method unserializable_attribute? appears to be defined in activerecord-3.1.3/lib/active_record/attribute_methods/read.rb. But that method no longer exists in the 3.2 version of read.rb.

So I'm guessing activerecord-jdbc-adapter needs some changes to work with the changes to Rails 3.2.

Anyone else running into this? or have a suggestion of how to resolve?

Was it helpful?

Solution

It turns out this bug was reported on the active recordjdbc-adapter github site, fixed, but not yet released as a new version to ruby gems.

If you have a rails app that uses jdbc to connect to a database, and you have BLOBs in any of your tables, you might want to wait to upgrade until the updated adapter is released.

Alternatively, if you don't want to wait, you can apply the straight forward fix posted at the activerecordjdbc-adapter github site. It's pretty simple at it's core; just find the call to :unserializable_attribute?(c.name, c) and replace it with value.is_a?(Hash)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top