Originally posted in rodloboz.com Introduction In the evolving landscape of web and application development, the need for reliable, scalable, and efficient data identification mechanisms is more critical than ever. As applications grow and handle in...

Markdown supported · ⌘↵ to post
Ishaq Bhallil
add this forget about it
#config/initializers/ulid_primary_key_defaults.rb module ActiveRecord module ConnectionAdapters class TableDefinition alias_method :original_primary_key, :primary_key
def primary_key(name, type = :bigint, options) if type == :ulid && !options.key?(:default) options[:default] = -> { "gen_ulid()" } end original_primary_key(name, type, options) end end end end