Wheels Blog

News, tutorials, and release announcements for the Wheels CFML MVC framework.

RSS

Associations Deep-Dive: hasMany, belongsTo, Nested Properties, and Eager Loading

Peter Amiri

A comprehensive Wheels 4.0 guide to model associations — hasMany, belongsTo, and hasOne, the exact dynamic methods each one generates, dependent-delete cascades, nested properties from form params, eager loading with include=, has-many-through, and polymorphic associations — with the sharp edges that bite in practice.

Form Helpers in Wheels 4.0: Object Forms, HTML5 Fields, and Error Rendering

Peter Amiri

A worked how-to on Wheels 4.0 form helpers: object-bound fields that round-trip into params.user.email, the real HTML5 single-input helpers, and the two error-rendering helpers — plus the sharp edges that bite first.

Validations Beyond Presence: Conditional Rules, Custom Validators, and Enum Integration

Peter Amiri

A practical Wheels 4.0 guide to the full validation surface — conditional rules with condition/unless/when, custom validate() methods, enum() integration, and how to read the error API correctly. Built end-to-end around one User model, with every behavior grounded in the framework source.

Routing Deep-Dive: Resources, Nested Callbacks, and Route Model Binding

Peter Amiri

A complete Wheels 4.0 routing guide — RESTful resources, nested resources via callback vs manual nested=true, and route model binding that resolves params.post before your action runs. Plus the sharp edges: route order, the protected-helper-names trap, and how a missing record 404s.

Seeding Your Database the Idempotent Way

Peter Amiri

Wheels 4.0 ships a convention-based seeder built around seedOnce() — an idempotent helper that creates a record only if a matching one doesn't already exist, wrapped in a transaction that rolls the whole run back on any failure. This is the worked guide: file conventions, the CLI, composite uniqueness, and the sharp edges.

Dependency Injection in Wheels 4.0: services.cfm, Scopes, and Auto-Wiring

Peter Amiri

A user-facing how-to for the Wheels 4.0 DI container: register services in config/services.cfm with singleton/request/transient scopes, resolve them anywhere with service(), declare them in controllers with inject(), and let constructor auto-wiring fill in the rest.

Writing Your Own Middleware in Wheels 4.0

Peter Amiri

A from-scratch guide to authoring custom middleware in Wheels 4.0 — the one-method interface, the singleton-per-app lifecycle and the thread-safety it demands, how to short-circuit, and how to register globally or per route.

Pagination That Isn't a Pain: paginationNav and the Preset System

Peter Amiri

A complete how-to on Wheels 4.0's paginationNav helper — the all-in-one nav, the bootstrap5/bootstrap4/tailwind preset system, the auto/always/never anchor tri-state, and the dev-time guardrails that catch typos before they ship.

Real-Time Without WebSockets: Server-Sent Events in Wheels 4.0

Peter Amiri

A worked guide to Wheels 4.0's Server-Sent Events helpers — renderSSE for one-shot events, the initSSEStream/sendSSEEvent/closeSSEStream trio for long-lived streams, plus isSSERequest content negotiation, keep-alive heartbeats, and the engine-fragility sharp edges to test for.

Beyond findAll: Scopes, Enums, and the Chainable Query Builder

Peter Amiri

Wheels 4.0 ships three model-side features that compose into one design: scopes name reusable query fragments, enums turn property values into auto-generated checkers and scopes, and the chainable query builder swaps raw WHERE strings for fluent, type-aware composition. This post walks all three through one worked example and surfaces the bug I hit while writing it.

Newsletter

Release notes and new posts, once a month. No spam.

Prefer RSS? Subscribe to the feed →