activeuuid icon indicating copy to clipboard operation
activeuuid copied to clipboard

Primary key column_hash is binary != :uuid

Open markalanevans opened this issue 10 years ago • 2 comments

On this line: https://github.com/jashmenn/activeuuid/blob/master/lib/activeuuid/uuid.rb#L146

self.class.columns_hash[primary_key].type => binary

which != :uuid

The db is mysql, i'm using the mysql2 gem and the field is a binary 16 field in the DB.

Version

activeuuid (0.6.0) activerecord (>= 3.1) uuidtools

markalanevans avatar May 06 '15 06:05 markalanevans

add a file activeuuid.rb in your project config/initializers will fix this issues

ActiveRecord::Base.connection_pool.with_connection do
  ActiveUUID::Patches.apply!
end

ghost avatar Sep 16 '15 10:09 ghost

Why is this needed? I see the patches being applied in the code here:

https://github.com/jashmenn/activeuuid/blob/master/lib/activeuuid.rb#L9

And here:

https://github.com/jashmenn/activeuuid/blob/master/lib/activeuuid/railtie.rb#L9

benjaminjackson avatar Jan 26 '16 14:01 benjaminjackson