Skip to content
This repository was archived by the owner on Aug 25, 2020. It is now read-only.

Add support for custom primary keys#44

Open
johnallen3d wants to merge 3 commits intoassaf:masterfrom
telus-agcg-archive:custom-pk
Open

Add support for custom primary keys#44
johnallen3d wants to merge 3 commits intoassaf:masterfrom
telus-agcg-archive:custom-pk

Conversation

@johnallen3d
Copy link
Contributor

This is probably seems like it's coming out of left field... We have integrated rack-oauth2-server into our API and the rest of our API uses UUID for id fields and we wanted to ensure consistency. Forking and modifying the codebase was the best option we could find (would have required too much monkey patching).

The idea here is you can swap out BSON::ObjectId for a UUID like so:

  # in configuration block
  oauth.pk_generator = Rack::OAuth2::UUIDGenerator

Let us know if this is something you are interested in and if there are changes/improvements we can make.

When switching to a UUID the find_one method will fail unless you pass a
hash: `{ :_id => id }`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant