Curated list of episodes, bundled to help you on your learning path!
Videos of tech, infrastructure, hardware and software which non-instructional by nature.
Articles around software and tutorials.
Show your love and support while looking fancy.
Got a question or want to chat about a topic? Let's talk!
I want to create a subscriber id which should be unique, can we use UUID as subscriber id ?
In general how people are creating unique subscriber id during registration ?
Do we have any ruby gem to get unique id by providing name, date and other parameter as input to the function to get new unique is ?
I also would like to know the pattern to generate ticket id as well, which is used in incident management where each reported incident is a ticket to be resolved.
You could use a UUID for this, but I think that it would probably be a bit overkill.
I would personally just do something like this with SecureRandom.hex (which is part of the ruby core)
before_create :populate_subscriber_id private def populate_subscriber_id begin self.subscriber_id = SecureRandom.hex end while self.class.exists?(subscriber_id: subscriber_id) end