Ruby on Rails Recipes
A collection of recipes for solid Ruby on Rails applications. Extracted from dozens of production apps and 10,000+ hours of deliberate Ruby on Rails practice since 2005:
Concerns
I know, I know,… Some people are concerned when they see the concerns
folder in your app. Read this to find out why I think they are useful anyways.
Configuration
The best practice to configure your app: Use ENV variables. Works for clusters, different types of deployments, and in development mode.
Documentation
Pretty much any serious Rails project will require some kind of documentation. Here is a set of conventions that have worked well for me.
Feature flags
How to dynamically enable app features for a given user.
How to change objects
This flowchart helps you decide on the right approach when changing data. It’s about Rails magic vs. Object Oriented best practices.
Naming and organizing your user facing code
Let use cases and roles drive how you organize and name your Controllers and Views.
Outcome.rb
Advanced return values for complex processing. Includes a success indicator, return value and user messages in a uniform interface.
Permissions and user roles
How to manage user roles and permissions.
Ruby coding style guide
Follow this style guide to make your code easy to read and reason about.