Add random-rails to the list of libraries #1178
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.