Events are Vue’s way of handling communication from children to parent components. But although the basics are very simple, the way you leverage on events will define a big deal of your application architecture.
Ruby beginners tend to skip the public/private classes until later in their learning course and people coming from other languages may find the way Ruby interfaces work quite unorthodox. In this article I will bring some light into this subject.
Rails transactions are a way to ensure that a set of database operations will only occur if all of them succeed. Otherwise, they will rollback to the previous state of data.
Our examples will demonstrate it in the most useful scenario for transactions: money transfers. In this case, you only want Ted to receive money if John loses the same money.
How many nights did you spend crying for all those Arel queries you had to write to attain a simple OR query in Rails? Well those times of suffering are over, give a warm welcome to the Rails 5 ActiveRecord OR query method!
It’s actually very simple to use but does have some caveats that we will see in a moment.
I remember when I was starting and saw the Active Record callbacks for the first time: “Wow they are so useful!” - I thought at the time. Oh god, how I was wrong.
I mean, they seem useful, and indeed they are useful for the first weeks. But then your application starts to grow and what before was pure joy becomes a series of headaches that culminate in your precious time being wasted in a lot of different ways.