4min snip

The Bike Shed cover image

440: When we stray from Rails defaults

The Bike Shed

NOTE

Navigating Callbacks and Rails Best Practices

In the Rails ecosystem, a distinction is made between elements above and below the web-facing layers, with a preference for utilizing available tools and frameworks above this line to avoid manual pain points. Experimentation with alternative libraries, such as Dry RB, indicates an openness to diverging from traditional Rails approaches. There is a growing awareness in the community regarding the pitfalls of using callbacks in Active Record, as they can complicate code by creating tight coupling between business logic and data persistence. This concern stems from the realization that callbacks, often introduced early in development, may not align with their intended purpose, leading to undesirable dependencies that complicate future maintenance. Best practices suggest that separating business logic from callbacks can promote cleaner architecture, preventing issues associated with tightly-coupled components. Overall, insight favors weighing the necessity of callbacks against potential alternatives to enhance code clarity and maintainability.

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode