0

I am updating my application from rails 4 to rails 5. My application is using activeuuid gem. The activeuuid gem is using alias_method_chain internally and this method is deprecated in rails 5. Now when I am trying to start rails console, I am getting error -

undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::Column:Class (NoMethodError)

Is there anyway I can continue using activeuuid gem in rails 5 and does not need to do any rework?

2 Answers2

0

Rails 5 has built-in support for UUID primary keys, so ideally you should migrate away from this gem...

Try just delete this gem from your project and all must be fine.

Source: https://github.com/jashmenn/activeuuid/issues/80

However if you want to keep using this gem you can find (or create your own) fork. Last commit to original gem was 4 years ago (before rails 5 release). But I see forks where support for rails 5 was realized.

QNester
  • 463
  • 4
  • 9
  • I used this - https://github.com/vindi/activeuuid/network/dependencies but it gives an error on server start - **wrong number of arguments (given 2, expected 1)** ...bundler/gems/activeuuid-5d63f0b44ba6/lib/activeuuid/patches.rb:112:in `quote' – Harshwardhan Rathore May 06 '19 at 08:49
0

Since I didn't received any solution to this problem and after searching all around I came to below solution -

  1. Removed the activeuuid gem from the application.
  2. Implemented uuids with Ruby's SecureRandom class - Rails 5 Mysql UUID
  3. In case if someone finds issue in saving record as activeuuid limits database column to 16 Bytes, one can use SecureRandom.hex(8).encode("UTF-8")