Skip to content

Conversation

@loqimean
Copy link

Project

random-rails

https://github.com/the-rubies-way/random-rails
https://rubygems.org/gems/random-rails

What is this Ruby project?

It’s a small gem that lets you fetch random records in Rails with much better performance than ORDER BY RANDOM() or offset-based approaches.

It integrates nicely with ActiveRecord and is open source, so you can easily see how it works or adjust it for your needs.

What are the main difference between this Ruby project and similar ones?

The main difference is performance and simplicity. Unlike many other gems that rely on ORDER BY RANDOM() or offset-based approaches—which can be very slow on large tables—this gem is optimized to fetch random records efficiently across supported databases (PostgreSQL, MySQL, SQLite).

It also integrates cleanly with ActiveRecord, works with scopes, and doesn’t require complex setup or custom SQL. The focus is on providing a fast, reliable, and easy-to-use solution for fetching random records in Rails.

@markets
Copy link
Owner

markets commented Oct 26, 2025

Still too fresh, as per our contrib guides, 30k downloads are required, this one is around 1k now... Lets wait some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants