Skip to Content

#generators

All journal entries tagged with ‘#generators’

Related Journal Entries

Rails Generator Cheat Sheets

Long-form prose can only go so far, and even perfect prose isn’t easy to reference after reading it. So with Frictionless Generators, I wanted to think about how people would be building generators after reading the book. I ended up creating a set of cheat sheets for after-the-fact help and reminders.

Rails Generator Parent Classes

What are the differences between Rails::Generators::Base and Rails::Generators::NamedBase? When would we want to use one over the other and why?

Create Generators that People Will Use

Creating a generator is one thing, but creating a generator that actually gets used is another. We’ll look at some of the ways we can make sure we’re building generators that the whole team uses.

ERb, Whitespace, and Indentation in Rails Generator Templates

When creating templates for custom generators, whitespace matters, so it’s helpful to know and understand the tools and tactics available to help us get it right. We can use whitespace-eliminating delimiters from ERb, generator helper methods, and built-in indentation helpers.

Even Small Rails Generators can Save Time and Tedium

It’s one thing to develop the skills to know how to build custom Rails generators, but it’s another to recognize the wide array of scenarios that lend themselves to saving time with custom generators of any size. Small generators collectively represent much of our time-saving opportunity.

Don't Sleep on Rails Custom Generators

Rails custom generators may not be the most well-known superpower in Rails, but they should definitely be on the list due to their ability to save time and reduce tedium. So I wrote a book to help us make the most of them.

Custom Rails Generators can be Your Secret Super Power

Creating your first custom Rails Generator can feel counter-productive at first, but with a little knowledge and experience, they can become a powerful tool to help you and your team save time.

Ruby Introspection on Rails Generators

I built an automated tool to inspect and document all of the available methods in a set of Ruby classes and modules in order to answer questions and provide data and insights that would help explore and recognize patterns and concepts with Rails Generators.

Rails Generator Actions

Almost everything done with Rails Generators happens using actions that streamline common tasks that would otherwise have to be performed with lower-level file system commands. Some of these actions are Rails-specific and some come from Thor. This post explores all of them as a unified collection.

Rails Generators & Templates

While it’s difficult to identify one specific piece of Rails Generators that makes them special, Thor’s templating functionality makes a strong case for being that feature. We’re going to see how it works and the how Rails streamlines the process in order to see how handy templates can be.

Creating Custom Rails Generators

Rails generators can help remove significant friction from the process of spinning up new ideas, but you don’t have to limit yourself to the included generators. You can also create custom generators as long as you’re familiar with the available APIs and know where the speed bumps are.