Hansel and Gretel’s breadcrumbs

centli allan garces
4 min readDec 28, 2021

This week I want to tell you that I learned a very cool way to ensure that an application is updated with the database it consults in order to offer its users the freshest information, it is implemented in a framework called “Ruby on Rails” (RoR ), in particular, I had never been given the opportunity to work with ruby, the programming language on which RoR is based, even less had I touched a library or framework that belonged to this language.

Photo by Joshua Fuller on Unsplash

I must say that installing RoR correctly on the computer was quite a challenge, but it was worth it because once I started to develop the small project so that I could create a database everything flowed with a smoothness that I didn’t expect.
When you create a project in RoR with the command:

rails g scaffold

you must add other parameters such as the name of your project, very important that it starts with a capital letter and is written in the singular English form, followed by the columns that you want in your database, such as name, last name, age, hobbies, email, etc, each of these fields must be indicated what type of data they belong to, for example, the name field would be established as follows:

name: string

This action is mandatory in order to ensure the field will be recibe a string of characters and not a number or a false or true for example, after putting all the fields you need with the type to which they belong, you just give enter and that’s it, your database is has created.

If you raise your project by running the following command in the terminal:

rails server

After this action, you will be able to see your project in the URL that is specified in the terminal.

[It is important to say that prior to this step you must define some methods so that your project works with the databases that you have just passed to it and is capable of handling the information but for practical terms of this writing I will skip this part. If you want to dive deep into this framework I highly recommend that you take a course about RoR, it doesn’t necessarily have to be paid, on the internet, there are many tutorials that explain how to build a simple project like the one I am describing here.]

When you enter the URL you will see that your project throws an error and it is that it asks you to do a database migration since it detects an inconsistency when having new data in the database that has not been transformed to the schema it RoR uses, the above is solved by running the command that is specified on the same page where the error is reported but in general, it should be something similar to:

rails db: migrate

Photo by Jon Tyson on Unsplash

Once you have run this command you will be able to see the new information on your page, the best thing about this is that for each migration or update that you do, you will be able to see in a file a timestamp that will indicate the exact moment in In which migration occurred, this is very helpful when there is an error that you want to locate in a timeline or you just want to go back to a specific previous version.

These little timestamps in your files reminded me of the Hansel and Gretel story and the importance of leaving evidence of your work.

The above is not only true in the technology field but it also applies to any activity that we do, for example, it has come to pass to me that I take small technology courses that catch my attention and develop with these, small exercises just for the pleasure that I can do them, I usually upload these jobs to my personal social networks. Until here there’s nothing out of the ordinary, but it is thanks to these projects that opportunities have opened up, opportunities that I didn’t know were there, for example, thanks to these bread crumbs I have left is that friends have approached me to ask if I am interested in collaborating with them, or simply if I know someone who can help them with a problem they have in case I don’t have the necessary experience.

Photo by Pierre Bamin on Unsplash

As you can see, leaving breadcrumbs that mark the work done by you over time is important to have an order of your activities and don’t get lost if you want to return, but it also helps you see how much you have advanced as person and last but not least, helps you connect with other people. Generating community is the most relevant of this entire journey, in the end why would you want to improve on your own without telling anyone?

When you share, everything improves because you help others to advance and that helps yourself too, in conclusion, we all advance together and I think this is the main goal in life, advance always in a group.

--

--