rails-presenter

Wrap Rails models with SimpleDelegator presenters for HTML-safe view formatting.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/reckerswartz/resume_builder --skill rails-presenter-reckerswartz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-presenter
Source: https://github.com/reckerswartz/resume_builder/tree/main/.windsurf/skills/rails-presenter
Command: npx skills add https://github.com/reckerswartz/resume_builder --skill rails-presenter-reckerswartz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rails presenters wrap models with SimpleDelegator to separate view formatting from business logic, enabling reusable display helpers and consistent badges.

Core Features & Use Cases

  • Wrap models for view-specific formatting using SimpleDelegator.
  • Provide HTML-safe output with helper methods and I18n integration.
  • Support a test-driven development workflow with specs-first iterating on presenters.

Quick Start

Create a failing presenter spec for a resource, implement the presenter extending BasePresenter, and run the specs to verify GREEN.

Frequently Asked Questions about rails-presenter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate view formatting from business logic in Rails?

Rails presenters isolate view formatting from business logic by wrapping models with SimpleDelegator. This pattern extracts display-specific methods, such as formatting and badges, into dedicated classes, keeping your models clean and ensuring consistent presentation across multiple views.

What is the best way to test Rails presenters using TDD?

The best way to test Rails presenters using TDD is a specs-first workflow. Create a failing presenter spec for the resource, implement the presenter extending BasePresenter, and run the specs to verify the output is HTML-safe and GREEN.

How do I ensure HTML-safe output when using presenters with ActionView helpers?

To ensure HTML-safe output with presenters, integrate ActionView helpers and I18n directly within your presenter methods. The BasePresenter pattern wraps the model and manages formatting safely, preventing cross-site scripting issues in the view layer.

When do I need a presenter pattern in my Rails application?

You need a presenter pattern in Rails when multiple views and components require consistent display formatting for the same model. It is specifically useful for generating reusable display badges and isolating complex view logic from the core business model.

Does the Rails presenter pattern work with I18n translations?

Yes, the Rails presenter pattern works with I18n translations. Presenters integrate ActionView helpers and I18n within the wrapper class, allowing you to resolve localized display formatting and output HTML-safe translated strings directly from the wrapped model.