Mateus Nava

Mateus Nava

January 18, 2022

A simple technique for trying out new things in Rails

By Pablo Arroyo (unsplash.com)
By Pablo Arroyo (unsplash.com)
One of the most interesting things to do in the development area is to try new things, some new library or even a new technique to improve performance. I really like doing this in Rails because it's very simple, in fact, you only need a few minutes to have a complete application with a few screens.

So my recipe for testing something new in Rails is:

The first thing is to create a new project, I will call this project miro-the-dog
rails new miro-the-dog

The second thing is to create a simple CRUD with scaffold generator, cities for example.
rails g scaffold cities name:string
rails db:migrate

Ok, now you have a CRUD

List

Form to create new City


I like to generate some data to have more real example, for this I use the Faker gem.
1_000.times { City.create!(name: Faker::Address.unique.city) }

Right now we have an application working with some screens and some data, is possible to do a lot of experiments and tests :), how cool is that?