我正在创建一个将分散的rails 3应用程序,我需要使用UUID作为我的表的主键,什么是最好的gem,插件为Job.我还想知道是否可以在不使用polymorphicable_type列的情况下使用ActiveRecord多态关系,假设我正在使用UUID.
我创建了一个 使用UUID作为键的http://github.com/boriscy/uuidrails3 演示,你应该检查lib /中的模块UUIDHelper以及所有的迁移.无需在数据库中添加主键,只需添加索引,因为主键验证字段的唯一性,但我们不需要使用UUID.
I'm using Rails 3.1 with PostgreSQL 8.4. Let's assume I want/need to use GUID primary keys. One potential drawback is index fragmentation. In MS SQL, a recommended solution for that is to use special sequential GUIDs. One approach to sequential GUIDs is the COMBination GUID that substitutes a 6-byte timestamp for the MAC address portion at the end of the GUID. This has some mainstream adoption: COMBs are available natively in NHibernate (NHibernate/Id/GuidCombGenerator.cs).
I think I've figured out …