Skip to content

UUID typecasting #174

@ekampp

Description

@ekampp

Hi there.

I'm using Neo4J, which uses this gem for attribute declaration.

I'm also building a Rails app that uses UUIDs as primary keys in my Postgres database. I would like to be able to reference these primary keys, e.g. user_id, and have them be of the UUID type.

This could look something like:

class Node
  include ActiveAttr::TypecastedAttributes
  attribute :user_id, type: UUID
end

Currently, I'm using type: String, but that doesn't ensure that the given value is actually a UUID, and I have to write Active Model validators to ensure this, which is a bit of a pain.

Any pointers on where to start working on a PR is much appreciated. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions