frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Using UUIDv7 with Ruby on Rails Without PostgreSQL 18

https://t27duck.com/posts/31-using-uuidv7-on-rails-without-postgresql-18
2•t27duck•3h ago

Comments

t27duck•3h ago
The app I work on at my day job uses UUIDs for primary keys. I'm not sure when/if an upgrade to PostgreSQL 18 will happen, but we wanted to take advantage of timestamp-based UUIDv7. Turns out, it's relatively easy to implement in current Rails with PostgreSQL < 18.
FBISurveillance•2h ago
Another option is to use `SecureRandom.uuid_v7` like this:

    # app/models/application_record.rb
    class ApplicationRecord < ActiveRecord::Base
      include PrimaryKeyGenerator
    end

    # app/models/concerns/primary_key_generator.rb
    module PrimaryKeyGenerator
      extend ActiveSupport::Concern

      included do
        after_initialize :generate_id
      end

      def generate_id
        return if self.class.attribute_types["id"].type != :uuid
        return if id.present?

        self.id ||= SecureRandom.uuid_v7
      end
    end

This also gives you the advantage of having your PK known before record persisted (maybe it's just me but I like my UUID PKs generated in app instead of db)
t27duck•1h ago
The big drawback is if your app also uses bulk sql inserts which bypasses model hooks. By letting the database handle it, all cases are covered.

In China, the Dream of Outrunning Time

https://www.nytimes.com/2025/11/08/world/asia/china-aging-longevity-science.html
1•bookofjoe•4m ago•1 comments

Downgrading Debian from testing to stable (trixie)

https://neilzone.co.uk/2025/11/downgrading-debian-from-testing-to-stable-trixie/
1•ColinWright•7m ago•0 comments

Germany considers the 'Nordic model' to curb sex work

https://www.dw.com/en/germany-considers-the-nordic-model-to-curb-sex-work/a-74673114
2•toomanyrichies•7m ago•0 comments

Ask HN: How do you get over the fear of sharing code?

2•sodokuwizard•7m ago•2 comments

Value classes are the new data classes

https://curiouslab.dev/0002-value-classes-are-new-data-casses.html
2•todsacerdoti•12m ago•0 comments

Large Language Models Struggle with Reading Clocks

https://spectrum.ieee.org/large-language-models-reading-clocks
1•Anon84•14m ago•0 comments

Lisbon Airport is turning away private jets inbound for the Web Summit

https://www.engadget.com/big-tech/the-lisbon-airport-is-turning-away-private-jets-inbound-for-the...
3•rock_artist•15m ago•0 comments

UK full fibre availability rises to cover 81% of UK premises

https://www.thinkbroadband.com/news/uk-full-fibre-availability-rises-to-cover-81-of-uk-premises
3•ksec•17m ago•0 comments

Managing Your Manager

https://yusufaytas.com/managing-your-manager/
8•yusufaytas•25m ago•0 comments

Comparing GPT-4o vs. GPT-4o-Mini: How Different AI Models Rank the Same Content

https://lightcapai.medium.com/i-used-ai-to-rank-your-articles-b8cc86f691da
3•hadiai•26m ago•1 comments

Trinity Desktop Environment R14.1.5 Released

https://trinitydesktop.org/newsentry.php?entry=2025.11.09
1•calvinmorrison•29m ago•0 comments

Math Books

https://github.com/valeman/Awesome_Math_Books
1•tzury•32m ago•0 comments

Why Wise and Airwallex aren't worried about stablecoins

https://text-incubation.com/why-wise-and-airwallex-arent-worried-about-stablecoins
1•krrishd•32m ago•0 comments

Jelly Slider

https://docs.swmansion.com/TypeGPU/examples/#example=rendering--jelly-slider
1•birdculture•34m ago•0 comments

Show HN: Fast Semantic Tool-filtering for MCP servers

https://github.com/Portkey-AI/mcp-tool-filter
1•roh26it•36m ago•0 comments

Basecamp's Shape Up is a Michelin restaurant brigade system for software

https://itwasjacob.com/posts/michelin-software-teams/
2•Bocajmai•37m ago•3 comments

A Powerful Tool to Override Constitutional Rights Goes to Court

https://www.nytimes.com/2025/11/08/world/canada/a-powerful-tool-to-override-constitutional-rights...
2•Teever•41m ago•1 comments

Show HN: Automate recurring GitHub project items from YAML config

https://github.com/Rindrics/recurring-backlog-item-creator
1•Rindrics•41m ago•0 comments

How this 31-year-old made $250M in 30 months

https://www.ft.com/content/ec749b06-651b-431d-bf0b-5b61c7b5fba0
1•mmarian•42m ago•2 comments

16-Bit Data Pointers on RV32

https://wren.wtf/shower-thoughts/16-bit-data-pointers-on-rv32/
2•todsacerdoti•44m ago•1 comments

Arti, a complete rewrite of the C Tor codebase in Rust

https://tpo.pages.torproject.net/core/arti/about/
3•sibellavia•47m ago•0 comments

Algorithms for Decision Making

https://algorithmsbook.com/decisionmaking/
3•__grob•47m ago•0 comments

Why unions are becoming a problem for self-driving cars

https://www.axios.com/2025/11/05/waymo-unions-boston-self-driving-cars
4•josephcsible•50m ago•3 comments

Bumble Berry Pi – A Cheap DIY Raspberry Pi Handheld Cyberdeck

https://github.com/samcervantes/bumble-berry-pi
5•MakerSam•50m ago•0 comments

Automating image resizing and format conversion with ImageMagick

https://transloadit.com/devtips/automating-image-resizing-and-format-conversion-with-imagemagick/
1•speckx•56m ago•0 comments

Long-Context Attention from Kernel Efficiency to Distributed Context Parallelism

https://arxiv.org/abs/2510.17896
1•PaulHoule•57m ago•0 comments

Marble Fountain

https://willmorrison.net/posts/marble-fountain/
2•chris_overseas•59m ago•0 comments

Bull markets make you feel smarter than you are

https://awealthofcommonsense.com/2025/11/ben-graham-bull-market-brains/
7•raw_anon_1111•1h ago•0 comments

Digital Woes: Why We Should Not Depend on Software (1994)

https://archive.org/details/digitalwoeswhywe0000wien
2•turtleyacht•1h ago•0 comments

AI Isn't Alchemy: Not Mystical, Just Messy

https://www.craftedlogiclab.com/devblog/devblog11092025
1•IanTepoot•1h ago•0 comments