Compare design iterations side by side

Preview multiple versions of your Rails views simultaneously. No feature flags, no database, no configuration. Just file names and URLs.

gem "action_version_preview"

The Problem

You are iterating on a design. Maybe Claude just gave you three different layouts for your dashboard. You want to compare them. You want to send them to your team and get feedback.

But every time you generate a new version, you overwrite the last one.

show.html.erb v1 (overwritten)
show.html.erb v2 (overwritten)
show.html.erb v3 (current)
?

You end up copying files into _old suffixes, creating git branches for each variation, or pasting markup into a notes app. This is friction that slows you down when you should be moving fast.

What you want is simple: maintain multiple versions, switch between them instantly, share any version with a URL.

How It Works

ActionVersionPreview uses Rails' native view variants, a feature that has been in the framework since 4.1.

Name your files

app/views/dashboard/
  show.html.erb # default
  show.html+v2.erb # variant :v2
  show.html+v3.erb # variant :v3
  show.html+redesign.erb # variant :redesign

Visit the URL

/dashboard
renders show.html.erb
/dashboard?vv=v2
renders show.html+v2.erb
/dashboard?vv=redesign
renders show.html+redesign.erb

That is it. Create a file, add the +variant suffix, visit the URL. No configuration required.

The Variant Switcher

Add the helper to your layout and get a floating widget that auto-detects available variants:

<%= variant_switcher %>
Variant switcher showing Default, V1, V2, V3, V4, V5, V6 buttons

The switcher appears when ?vv is in the URL, showing all detected variants

Click between versions without editing the URL. The widget only appears when preview mode is active, and it automatically finds all +variant files for the current action.

Perfect for LLM Workflows

Designing in code with LLMs is fast. You describe what you want, you get working markup in seconds. But the speed creates a new problem: you keep overwriting your options.

Claude generating UI code with multiple variant files open in editor

Generate variants with Claude, save them as +v2, +v3 files, compare instantly

The workflow:

1. Ask Claude for three versions of your component
2. Save them as component.html.erb, component.html+v2.erb, component.html+v3.erb
3. Open three browser tabs with ?vv=default, ?vv=v2, ?vv=v3
4. Compare. Pick the winner. Delete the losers.

Features

Zero Config

Add the gem, create variant files, done. No initializers, no database, no Redis.

URL-Based Sharing

Send ?vv=redesign to anyone. They see the variant. No setup on their end.

Side-by-Side Tabs

Open multiple browser tabs, each with a different variant. Same session, same data, different views.

Works Everywhere

Layouts, partials, mailers, ViewComponents. Anywhere Rails looks for a template.

Auto-Detection

The switcher finds all variants for the current action automatically. Standard Rails variants (mobile, tablet) are excluded.

Access Control

Dev/test by default. Configure to allow admins in production.

Why Not Feature Flags?

Feature flags answer "which users should see this?" They are built for percentage rollouts, A/B testing, and kill switches.

That is not what you need when iterating on designs. You are trying to look at three versions and pick one.

Feature Flags ActionVersionPreview
Toggle on/off for users All versions accessible simultaneously
One version "live" at a time Side-by-side in multiple tabs
Percentage rollouts, A/B tests Design iteration, feedback
Requires database or Redis Zero dependencies
Conditionals in views Clean, separate files

Use feature flags when you need controlled rollouts to real users. Use ActionVersionPreview when you need to compare options before choosing what to ship.

Getting Started

Gemfile

gem "action_version_preview"

Create a variant:

app/views/posts/show.html+v2.erb

<h1>Version 2 of <%= @post.title %></h1>
<!-- Your alternative layout -->

Add the switcher (optional):

app/views/layouts/application.html.erb

<%= variant_switcher %>

Visit the page:

/posts/1?vv=v2
Shows v2 directly
/posts/1?vv=true
Activates switcher

Now go iterate.

No database. No Redis. No configuration.
Just Rails doing what Rails already knows how to do.