Recently, I have been building a Rails RESTful-API and I found out about the
enum feature in ActiveRecord. Let's see how you can use it.
We will be building a very simple blog app where we have a BlogPost model to store the posts.
Notice that we are using
int as the datatype for the state property. That’s because ActiveRecord::Enum stores the data internally as an integer and lets you use it as a string.
Advantages include smaller storage required, faster queries and indexes.
Let’s get started by generating an API-only app and get our hands dirty:
rails new blog…
You got into college. Congratulations! ✨
Computer science is one of the most interesting fields, at least it is for me. My first day at college wasn’t the perfect one. I had no friends from my city. I was alone. So tip #1 is “Make Friends”. If there is one thing that I miss from my daily life at college it is my friends. Choose them carefully. 💕
Now to your first lecture, the one you will remember the most. I was lucky that Dr. Mahmoud ElGayyar was the lecturer back then. You should treat your doctors respectfully. During your…
If you want to build magnificent software it’s better to be an open-source project. having a great community of developers with cultures from all over the world is great. you will have a huge diversity of ideas, solutions, and contributions. you can get different people to look at your codebase with their different backgrounds according to their skills and knowledge, for example, you might have a security researcher finding bugs and vulnerabilities in your code. there might be a software architect out there giving you a piece of advice for your code.
building software takes time and resources as well…
Computer Science Student