Analysis updated 2026-05-18
Create a versioned database view with a generator instead of writing raw SQL in a migration.
Back an ActiveRecord model with a view to expose complex joined or calculated data as a first-class model.
Add a materialized view to speed up an expensive query and refresh it on a schedule.
Update an existing view's definition while keeping migration history reversible.
| scenic-views/scenic | fatfreecrm/fat_free_crm | nesquena/rabl | |
|---|---|---|---|
| Stars | 3,621 | 3,626 | 3,631 |
| Language | Ruby | Ruby | Ruby |
| Setup difficulty | moderate | moderate | easy |
| Complexity | 2/5 | 3/5 | 3/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires a Rails app already using PostgreSQL, other databases need a third-party adapter.
Scenic is a Ruby gem for Rails applications that adds database views to your project without giving up the standard Rails migration workflow. A database view is a saved SQL query that, from the application's perspective, looks and behaves like a regular table: you can query it, sort it, and filter it the same way, but the database computes the data from a SQL statement rather than storing it directly. Without a tool like Scenic, adding a view to a Rails project typically means writing raw SQL strings inside migration files, which can become fragile and hard to maintain. Scenic introduces a versioning system: each version of a view gets its own SQL file stored in db/views/, named with a version number. When you update a view, a new version file is created alongside the old one, and a Rails migration records the transition. Rollbacks work correctly, and the history stays readable. Rails generators are included for creating both views and view-backed models. Running a generator creates the SQL file and the accompanying migration at the same time. You write the actual query in the SQL file and get full syntax highlighting in your editor of choice. A view can back a regular ActiveRecord model, meaning the model reads from the view just as it would from a plain database table. This is useful for surfacing complex calculated or joined data as first-class objects in your application code rather than embedding long queries throughout the codebase. Scenic also supports materialized views, which store query results as a cached snapshot in the database that can be refreshed on a schedule. Materialized views can be indexed, which makes them practical for expensive queries that would be slow to compute on every request. Scenic supports both concurrent and non-concurrent refresh strategies. The gem ships with PostgreSQL support, and the adapter interface is configurable for other databases.
A Ruby gem that lets Rails apps manage database views with versioned SQL files and regular, reversible migrations.
Mainly Ruby. The stack also includes Ruby, Rails, ActiveRecord.
Not stated in the explanation provided.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.